-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFOOTBALL QUIZ Python project.txt
More file actions
87 lines (76 loc) · 2.81 KB
/
FOOTBALL QUIZ Python project.txt
File metadata and controls
87 lines (76 loc) · 2.81 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
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
import time
def start_quiz(name):
questions = [
{
"question": "1. Who won the FIFA World Cup in 2022?",
"options": ["A. Brazil", "B. France", "C. Argentina", "D. Germany"],
"answer": "C"
},
{
"question": "2. Which footballer is known as 'CR7'?",
"options": ["A. Lionel Messi", "B. Cristiano Ronaldo", "C. Neymar", "D. Kylian Mbappe"],
"answer": "B"
},
{
"question": "3. Which country has won the most FIFA World Cups?",
"options": ["A. Italy", "B. Germany", "C. Argentina", "D. Brazil"],
"answer": "D"
},
{
"question": "4. Which club does Lionel Messi currently play for (as of 2025)?",
"options": ["A. PSG", "B. Inter Miami", "C. Barcelona", "D. Manchester City"],
"answer": "B"
},
{
"question": "5. In football, how many players are on the field for one team during a match?",
"options": ["A. 9", "B. 10", "C. 11", "D. 12"],
"answer": "C"
}
]
score = 0
correct_answers = 0
points_per_question = 2
print("\nStarting quiz...\n")
start_time = time.time()
for q in questions:
print(q["question"])
for option in q["options"]:
print(option)
answer = input("Your answer (A/B/C/D): ").strip().upper()
if answer == q["answer"]:
score += points_per_question
correct_answers += 1
print("Correct!\n")
else:
print(f"Wrong! The correct answer is {q['answer']}.\n")
end_time = time.time()
total_time = round(end_time - start_time, 2)
print(f"Quiz completed! You got {correct_answers} out of {len(questions)} correct.")
print(f"Your total score is: {score} out of {points_per_question * len(questions)}")
print(f" Time taken: {total_time} seconds")
if score == 10:
print(" Excellent job!")
elif score >= 6:
print(" Good effort!")
else:
print(" keep practicing!")
while True:
name = input("Enter your full name: ").strip()
if name == "":
print("Name cannot be empty. Please enter your full name.")
else:
print(f"Hello {name}")
break
while True:
result = input(f"{name}, are you ready for the football quiz? (Y/N): ").strip().upper()
if result == "Y":
start_quiz(name)
again = input("\nDo you want to retake the quiz? (Y/N): ").strip().upper()
if again != "Y":
print("Thanks for playing the quiz!")
break
elif result == "N":
print("THANK YOU. Come back when you're ready!")
break
else:
print("Please enter Y or N.")