Do this… Not like that… Oh… C’mon…

--Originally published at M E R I N O

Ok, let’s go straight to the point. Humans never follow instructions. Why? Because we’re humans and we love doing whatever we want.

The problem is that computers don’t work that way. If a program ask you to write 7, as a number not as letters.

As programmers we can “obligate” the user to write the way we want.

How? With a cool function called try and except

Captura de pantalla 2016-10-28 a la(s) 22.24.58.png

Captura de pantalla 2016-10-28 a la(s) 22.28.00.png

Captura de pantalla 2016-10-28 a la(s) 22.28.41.png

This make the question if “something” isn’t an integer then print “this is not a whole number”, if it is, then print “Good Job!”.

If you want to know more about validating inputs click here