forked from 19th/christmas-quizz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquizz.py
176 lines (167 loc) · 4.03 KB
/
quizz.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
import random
# Questions about Latvia
questions = [
# Ilja Karpovs
{
"question": "Cik briezi bija Ziemassvētku ragavas?",
"options": ["6", "7", "9", "12"],
"correct_answer": "9"
},
# Burovs Rodions
{
"question": "",
"options": ["a", "b", "c", "d"],
"correct_answer": "a"
},
# Daņilovs Roberts
{
"question": "",
"options": ["a", "b", "c", "d"],
"correct_answer": "a"
},
# Dmitrijevs Kirils
{
"question": "",
"options": ["a", "b", "c", "d"],
"correct_answer": "a"
},
# Jevstifejevs Vladislavs
{
"question": "",
"options": ["a", "b", "c", "d"],
"correct_answer": "a"
},
# Kisļaks Kirills
{
"question": "",
"options": ["a", "b", "c", "d"],
"correct_answer": "a"
},
# Korsaks Edvīns
{
"question": "",
"options": ["a", "b", "c", "d"],
"correct_answer": "a"
},
# Kozinda Dmitrijs
{
"question": "",
"options": ["a", "b", "c", "d"],
"correct_answer": "a"
},
# Nosovs Artjoms
{
"question": "",
"options": ["a", "b", "c", "d"],
"correct_answer": "a"
},
# Rudņevs Dmitrijs
{
"question": "",
"options": ["a", "b", "c", "d"],
"correct_answer": "a"
},
# Savostijanova Jelizaveta
{
"question": "",
"options": ["a", "b", "c", "d"],
"correct_answer": "a"
},
# Silickis Marks
{
"question": "",
"options": ["a", "b", "c", "d"],
"correct_answer": "a"
},
# Zaicevs Daņila
{
"question": "",
"options": ["a", "b", "c", "d"],
"correct_answer": "a"
},
# Adadurova Anastasija
{
"question": "",
"options": ["a", "b", "c", "d"],
"correct_answer": "a"
},
# Bogdanovs Ņikita
{
"question": "",
"options": ["a", "b", "c", "d"],
"correct_answer": "a"
},
# Grigorenko Artjoms
{
"question": "",
"options": ["a", "b", "c", "d"],
"correct_answer": "a"
},
# Mahajevs Maksims
{
"question": "",
"options": ["a", "b", "c", "d"],
"correct_answer": "a"
},
# Mieriņs Aleksandrs
{
"question": "",
"options": ["a", "b", "c", "d"],
"correct_answer": "a"
},
# Pavlova Anastasija
{
"question": "",
"options": ["a", "b", "c", "d"],
"correct_answer": "a"
},
# Roguļskis Aleksandrs
{
"question": "",
"options": ["a", "b", "c", "d"],
"correct_answer": "a"
},
# Švecs Kristians
{
"question": "",
"options": ["a", "b", "c", "d"],
"correct_answer": "a"
},
# Vasiļjeva Anastasija
{
"question": "",
"options": ["a", "b", "c", "d"],
"correct_answer": "a"
},
# Vinčenko Nikita
{
"question": "",
"options": ["a", "b", "c", "d"],
"correct_answer": "a"
},
]
def run_quiz():
# Shuffle the questions
random.shuffle(questions)
# Initialize score
score = 0
# Iterate through questions
for i, question_data in enumerate(questions, 1):
if question_data['question'] == "":
continue
print(f"Jautājums {i}: {question_data['question']}")
for j, option in enumerate(question_data['options'], 1):
print(f" {j}. {option}")
# Get user input
user_answer = input("Atbilde (ieraksti varianta numuru): ")
# Check if the answer is correct
correct_answer = question_data['options'].index(question_data['correct_answer']) + 1
if user_answer == str(correct_answer):
print("Pareizi!\n")
score += 1
else:
print(f"Kļūda! Pareizā atbilde ir {correct_answer}: {question_data['correct_answer']}\n")
# Display final score
print(f"Gala rezultāts: {score}/{len(questions)}")
# Run the quiz
run_quiz()