Skip to content

Instantly share code, notes, and snippets.

@besirkurtulmus
Created September 15, 2014 05:08
Show Gist options
  • Save besirkurtulmus/85368167d45b1a69facf to your computer and use it in GitHub Desktop.
Save besirkurtulmus/85368167d45b1a69facf to your computer and use it in GitHub Desktop.
Valid integer raw_input
'''
Simple way to get valid integer raw_input in Python 2.7
'''
def earn():
try:
userInput = int(raw_input("Enter your earnings:"))
print "you earn: " + str(userInput)
except ValueError:
print "Please reenter an integer"
earn()
earn()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment