-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1_animal_quiz2.py
42 lines (33 loc) · 1.13 KB
/
1_animal_quiz2.py
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
33
34
35
36
37
38
39
40
41
42
answer =["polar bear","cheetah","blue whale","aakash kumar","rahul kumar pathak","ankush","yes"]
questions_list =["Which bear lives at the North Pole? ","Which is the fastest land animal?","Which is the largest animal? ","Who is the most powerful person?","Who is Pathak ji","Who is chatur ?","Are you a fool?"]
counter =0
score =0
def check_answer(user_input):
global counter
global score
x = 0
while(user_input.lower() != answer[counter]):
# giving chances for wrong answers
print("Sorry, wrong answer. Try again. ")
user_input = input()
x =x +1
if x==2:
break
# reducing marks for wrong answers
score = score-x
if(user_input.lower() == answer[counter]):
print("correct answer")
else:
print(f"correct anser is {answer[counter]}")
counter+=1
score +=1
return counter
def questions():
for i in questions_list:
print(i)
user_input = input()
check_answer(user_input)
return score
print("Guess the Animal!")
score = questions()
print(f"Your score is {score}")