Skip to content

Instantly share code, notes, and snippets.

@enricopolanski
Last active July 13, 2017 12:28
Show Gist options
  • Save enricopolanski/7e876bfa5b7200a5fe85a5850546f86b to your computer and use it in GitHub Desktop.
Save enricopolanski/7e876bfa5b7200a5fe85a5850546f86b to your computer and use it in GitHub Desktop.
while True:
try:
height = int(input("Enter a number between 0 and 23: "))
except (ValueError):
print("Not an integer!")
continue
else:
if not 0 <= height <= 23:
print("Height's smaller than 0 or bigger than 23")
continue
else:
break
print("You selected an height of " + str(height))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment