Created
February 15, 2022 20:56
-
-
Save askingalot/4b98d96300d596093a10e523968e6610 to your computer and use it in GitHub Desktop.
Python Input Validation
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
str_monkey_count = input("How many monkeys will fit in your living room? ") | |
while not str_monkey_count.isnumeric(): | |
str_monkey_count = input("Please give me a number of monkeys! ") | |
monkey_count = int(str_monkey_count) | |
if monkey_count > 1: | |
print("I hope those monkeys get along") | |
elif monkey_count == 1: | |
print("Lonesome monkey :(") | |
else: | |
print("Why do you even have a living room if you don't keep monkeys in it?") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment