-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquiz.py
More file actions
48 lines (38 loc) · 1.13 KB
/
quiz.py
File metadata and controls
48 lines (38 loc) · 1.13 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import random
questions=("who published the human development index?:",
"who was the last viceroy of india ?:",
"when did the indochina war take place?:")
options=(("A.UNDP","B.IMDP","C.UNEP","D.UNPE"),
("A.Lord Louise Mountbatten","B.montbTTAN","C.Leonice","D.goese"),
("A.1946","B.1234","C.1924","D.1848"))
answers=("A","A","A")
guesses=[]
score=0
question_number=0
for question in questions:
print("----------------")
print(question)
for option in options [question_number]:
print(option)
guess=input("Enter(A,B,C,D): ").upper()
guesses.append(guess)
if guess == answers[question_number]:
score+=1
print("CORRECT!")
else:
print("INCORRECT!")
print(f"{answers[question_number]} is the correct answer ")
question_number+=1
print("----------------------")
print("RESULT")
print("----------------------")
print("answers:" ,end="")
for answer in answers:
print(answer ,end="")
print()
print("guesses:",end="")
for guess in guesses:
print(guess,end="")
print()
score=int(score/len(questions)*100)
print(f"your score is : {score}% ")