Skip to content

Commit fab1937

Browse files
authored
Merge pull request #44 from Shuchi2211/patch-2
Create Animal_Quiz.py
2 parents 3ee55e5 + d6e93bd commit fab1937

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Basic Scripts/Animal_Quiz.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
def check_guess(guess, answer):
3+
global score
4+
still_guessing = True
5+
attempt = 0
6+
while still_guessing and attempt < 3:
7+
if guess.lower() == answer.lower():
8+
print("Correct Answer")
9+
score = score + 1
10+
still_guessing = False
11+
else:
12+
if attempt < 2:
13+
guess = input("Sorry Wrong Answer, try again")
14+
attempt = attempt + 1
15+
if attempt == 3:
16+
print("The Correct answer is ",answer )
17+
18+
score = 0
19+
print("Guess the Animal")
20+
guess1 = input("Which bear lives at the North Pole? ")
21+
check_guess(guess1, "polar bear")
22+
guess2 = input("Which is the fastest land animal? ")
23+
check_guess(guess2, "Cheetah")
24+
guess3 = input("Which is the larget animal? ")
25+
check_guess(guess3, "Blue Whale")
26+
print("Your Score is "+ str(score))

0 commit comments

Comments
 (0)