Created
April 23, 2017 13:48
-
-
Save Kwpolska/c6ba787bf12fd29a34b86117c2bb74ae to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def ask_int(question): | |
"""Ask a question and return an integer.""" | |
while True: | |
try: | |
return int(input(question)) | |
except ValueError: | |
print("Not a number, please try again.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment