diff --git a/05/animal_game.py b/05/animal_game.py new file mode 100644 index 0000000000000000000000000000000000000000..e01538296ef2366fc97fb29753937e54f1499035 --- /dev/null +++ b/05/animal_game.py @@ -0,0 +1,20 @@ +import random +from game_utils import ask_for_choice, prompt_yes_no + + +def play_animal_game(): + choices = ['cow', 'dog', 'horse', 'cat', 'bird'] + choice = random.choice(choices) + animal = ask_for_choice( + "Which animal am I thinking of between " + ", ".join(choices) + "? ", choices) + if animal == choice: + print("Yes! It was " + choice + "!") + else: + print("No! It was " + choice + "!") + + +again = True +while again: + play_animal_game() + again = prompt_yes_no('Would you like to play again (y/n)? ') + print("Goodbye!")