1

I have a basic program that I am trying to make fool proof, and not come up with an error when the wrong type of data is entered.

Here is my code (Python 2)

   choice = raw_input("Enter a number")
   choice = int(choice)
   print choice + 1

However, when I enter a letter, it tries to convert it into a integer and fails. What would be the best way to overcome this?

Nnoka
  • 15
  • 3

0 Answers0