-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanimalQuiz.py
More file actions
32 lines (29 loc) · 1 KB
/
animalQuiz.py
File metadata and controls
32 lines (29 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
def check_guess(guess, answer):
global score
still_guessing = True
attempt = 0
while still_guessing and attempt < 3:
if guess.lower() == answer.lower():
#if guess.upper() == answer.upper():
print('Correct answer')
score = score + 3 - attempt
still_guessing = False
else:
if attempt < 2:
guess = input('Sorry wrong answer. Try again. ')
attempt = attempt + 1
if attempt == 3:
print('The correct answer is ' + answer)
score = 0
print('Guess the Animal!')
guess1 = input('Which bear lives at the North Pole? ')
check_guess(guess1, 'polar bear')
guess2 = input('Which is the fastest land animal? ')
check_guess(guess2, "cheetah")
guess3 = input('Which is the largest animal? ')
check_guess(guess3, 'blue whale')
guess = input('Which one of these is a fish? \n A) Whale\n B)Dolphin\n C)Shark\n D)Squid\n Type A, B, C, or D')
check_guess(guess, 'C')
guess4 = input('Mice are mammals, True or False ')
check_guess(guess4, 'True')
print('Your score is ' + str(score))