-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuiz.py
More file actions
31 lines (24 loc) · 666 Bytes
/
Quiz.py
File metadata and controls
31 lines (24 loc) · 666 Bytes
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
questions = {
"What is the capital of India?": "c",
"Who discovered gravity?": "a",
"Which language is used for AI?": "b"
}
options = [
["a) Mumbai", "b) Kolkata", "c) Delhi", "d) Chennai"],
["a) Newton", "b) Einstein", "c) Galileo", "d) Tesla"],
["a) HTML", "b) Python", "c) CSS", "d) Bootstrap"]
]
score = 0
qno = 0
for question in questions:
print("\n" + question)
for opt in options[qno]:
print(opt)
ans = input("Enter option (a/b/c/d): ").lower()
if ans == questions[question]:
print("Correct!")
score += 1
else:
print("Wrong!")
qno += 1
print("\nYour Total Score:", score)