-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquiz.py
More file actions
49 lines (42 loc) · 1.16 KB
/
quiz.py
File metadata and controls
49 lines (42 loc) · 1.16 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
49
#Quiz game with programming questions
#Q&A
info = [
{
"question": "¿Which is not a programming language?",
"choices": ["Python", "CSS", "PHP", "Javascript", "R"],
"answer": 2,
},
{
"question": "¿Which is not a code editor?",
"choices": ["Visual studio", "Sublime text", "Vim", "Word", "Atom"],
"answer": 4,
},
{
"question": "¿Which is the javacript extension?",
"choices": [".jp", ".js", ".jc", ".ji", ".ja"],
"answer": 2,
},
{
"question": "¿Which is not a framework?",
"choices": ["React", "Vue", "Tailwind", "Angular", "Kotlin"],
"answer": 5,
},
{
"question": "¿Which language has an animal in its logo?",
"choices": ["C#", "Java", "C++", "Python", "PHP"],
"answer": 4,
}
]
#Score
score = 0
for i in range(len(info)):
questions = info[i]["question"]
options = info[i]["choices"]
answers = info[i]["answer"]
print(questions)
for n,j in enumerate(options):
print(f"{n+1} - {j}")
user = int(input("Your answer: "))
if user == answers:
score += 1
print(f"Final score: {score}")