Skip to content

Instantly share code, notes, and snippets.

@Kwpolska
Created Apr 23, 2017
Embed
What would you like to do?
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