-
Notifications
You must be signed in to change notification settings - Fork 0
/
quiz_game.py
58 lines (51 loc) · 1.61 KB
/
quiz_game.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 27 16:20:48 2022
@author: VARUN
"""
quiz = {
"question1":{
"question": "What is the capital of France?",
"answer": "Paris"
},
"question2":{
"question": "What is the capital of India ?",
"answer": "New Delhi"
},
"question3":{
"question": "What is the capital of Pakistan?",
"answer": "Islamabad"
},
"question4":{
"question": "What is the capital of Italy?",
"answer": "Rome"
},
"question5":{
"question": "What is the capital of Prtugal?",
"answer": "Lisbon"
},
"question6":{
"question": "What is the capital of Germany?",
"answer": "Berlin"
},
"question7":{
"question": "What is the capital of Russia?",
"answer": "Moscow"
},
"question8":{
"question": "What is the capital of Australia?",
"answer": "Canberra"
},
}
score = 0
for key, value in quiz.items():
print(value['question'])
answer = input("Answer: ")
if answer.lower()== value['answer'].lower():
print('Correct')
score = score+1
print("Your score is: " + str(score))
else:
print("Wrong!")
print("The answer is: " + value['answer'])
print("Your score is: " + str(score))