Skip to content

Instantly share code, notes, and snippets.

@mikelopez
Last active April 24, 2020 01:54
Show Gist options
  • Save mikelopez/7a115f1a42a041b91099afe7585cbac4 to your computer and use it in GitHub Desktop.
Save mikelopez/7a115f1a42a041b91099afe7585cbac4 to your computer and use it in GitHub Desktop.
import sys
def ask_number(msg="Enter a number"):
num = float(input(msg))
if not type(num) in [float, int]:
print("Not a number!")
ask_number(msg)
else:
return num
num = ask_number()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment