Created
September 15, 2014 05:08
-
-
Save besirkurtulmus/85368167d45b1a69facf to your computer and use it in GitHub Desktop.
Valid integer raw_input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
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