animal_game.py 561 Bytes
Newer Older
Adam Blank's avatar
Adam Blank committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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!")