File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
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 ))
You can’t perform that action at this time.
0 commit comments