-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuiz.py
More file actions
32 lines (28 loc) · 1.12 KB
/
Quiz.py
File metadata and controls
32 lines (28 loc) · 1.12 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
questions=("How many elements are in the periodic table?:",
"Which animal lays the largest egg?:",
"What is the most abundant gas in Earth's atmosphere?:",
"How many bones are in human body?:",
"Which planet in the solar system is the hottest?:")
options=(("A. 116","B. 117","C. 118","D. 119"),
("A. Whale","B. Crocodile","C. Elephant","D. Ostrich"),
("A. Nitrogen","B. Oxygen","C. Carbon-dioxide","D. Hydrogen"),
("A. 206","B. 207","C. 208","D. 209"),
("A. Mercury","B. Venus","C. Earth","D. Mars"))
answers=("C","D","A","A","B")
guesses=[]
score=0
question_num=0#starts from index 0
for question in questions:
print("--------------------")
print(question)
for option in options[question_num]:#used as index
print(option)
guess=input("Enter(A,B,C,D):").upper()
guesses.append(guess)
if guess==answers[question_num]:
score+=1
print("CORRECT!")
else:
print("INCORRECT!")
print(f"{answers[question_num]} is the correct answer")
question_num+=1#to move into nxt qn