-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
84 lines (58 loc) · 2.41 KB
/
main.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
import round1, round2, round3, random, math, rules
def main():
'''
Parameter: No parameters
Purpose: Starts the Math Quiz
Return: No return value (returns None)
'''
# Greets the user
print("Welcome to the FUN MATH QUIZ!\n")
# Explanation of the game to the user
print("There will be 3 rounds in total and 5 questions in each round:")
print("Round 1:\tMultiply & Divide")
print("Round 2:\tSolving Quadratic Equations")
print("Round 3:\tSolving Right Triangles")
# Outputs the rules to the user
rules.rules()
# User is prompted to enter anything to start the game
print("ARE YOU READY TO START?? (Enter anything to start the game)")
input()
# Original number of questions user answered correctly and number of questions the user has answered
score = 0
questions = 0
# Round #1
print("ROUND 1 BEGIN\n")
# 5 questions for Round 1
for i in range(5):
print("ROUND 1 QUESTION "+str(i+1)+"\n")
# Round 1 function call
if (round1.r1(score, questions)):
# If the user answered the question correctly, the number of questions answered correctly increases by 1
score += 1
# The number of questions the user answered increases by 1 each time
questions += 1
# Round #2
print("ROUND 2 BEGIN\n")
# 5 questions for Round 2
for i in range(5):
print("ROUND 2 QUESTION "+str(i+1)+"\n")
# Round 2 function call
if (round2.r2(score, questions)):
# If the user answered the question correctly, the number of questions answered correctly increases by 1
score += 1
# The number of questions the user answered increases by 1 each time
questions += 1
# Round #3
print("ROUND 3 BEGIN\n")
# 5 questions for Round 3
for i in range(5):
print("ROUND 3 QUESTION "+str(i+1)+"\n")
# Round 3 function call
if (round3.r3(score, questions)):
# If the user answered the question correctly, the number of questions answered correctly increases by 1
score += 1
# The number of questions the user answered increases by 1 each time
questions += 1
# Outputs the final score of the user
print("\nYour final score is",score,"out of", str(questions) + ".")
main()