kp01aj / lab-Se1003

0 stars 0 forks source link

Question From Exercise 2 Of Practice N.3. (Exercises with conditionals). #10

Open Erick-Mercedes opened 4 years ago

Erick-Mercedes commented 4 years ago

When entering a number on the keyboard and saying if it is even or odd, what should I do to indicate to the user that the entered digit is not a number but a letter?

Erick Alexander Mercedes Peña. 16-EISM-1-095. Section: 1003

Valeriesanchez427 commented 4 years ago

When we declare a variable and we want the user to enter a digit, we need to indicate to the variable what kind of data is going to be entered, be it integer, float, etc., otherwise the program will give an error. ex: numero1=input("Introduzca el primer digito") that's pretty wrong the right way shall be numero1=int(input("Introduzca el primer digito ")) here I declare the variable and indicate what type of data the user can enter by keyboard which is an integer