-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
160 lines (132 loc) · 4.55 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
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
import random
import time
print("\t-----WELCOME TO MENTAL MATH JUNKIE-----")
print(" The Game will evaluate your Math Reflexes 🧠 ")
print(" ")
print("---MODES---")
print("1: Amature(EASY)🤕")
print("2: Pro(MEDIUM)🔥")
print("3: Monk Mode(HARDEST)🗿")
print("ANY KEY: EXIT 🚶")
choice = int(input("Enter your Level: "))
if choice == 1:
print(" ")
print("You've Entered: Amature(EASY)🤕 MODE")
print(" ")
start_time = time.time()
score = 0
i = 0
while i < 10:
num1 = random.randint(0, 10)
num2 = random.randint(1, 10) # Make sure num2 is not zero for division
operation = random.choice(['+', '-'])
if operation == '+':
result = num1 + num2
elif operation == '-':
result = num1 - num2
answer = input(f"-> Problem {i+1}: {num1} {operation} {num2} = ")
# Validate the user's input
try:
if float(answer) == result:
print("Correct!")
score += 1
else:
print(f"Wrong! The correct answer is {result}")
except ValueError:
print("Invalid input. Please enter a number.")
i += 1
end_time = time.time()
total_time = end_time - start_time
print("---------------------------------------")
print(f"You scored a total of {score} points")
if score >= 8:
print("\t\tYOU ARE BETTER THAN AMATURE, GO TRY THE PRO MODE🔥🔥🔥")
if score >= 5 and score < 8:
print("\t\tTRY AGAIN NEXT TIME")
if score < 5:
print("\t\tYOU SURE YOU PASSED ELEMENTARY...🤣")
print(f"You took a total of {total_time:.2f} seconds")
elif choice == 2:
print(" ")
print("You've Entered: Pro(MEDIUM)🔥 MODE")
print(" ")
start_time = time.time()
score = 0
i = 0
while i < 10:
num1 = random.randint(10, 100)
num2 = random.randint(11, 100) # Make sure num2 is not zero for division
operation = random.choice(['+', '-', '*'])
if operation == '+':
result = num1 + num2
elif operation == '-':
result = num1 - num2
elif operation == '*':
result = num1 * num2
answer = input(f"-> Problem {i+1}: {num1} {operation} {num2} = ")
# Validate the user's input
try:
if float(answer) == result:
print("Correct!")
score += 1
else:
print(f"Wrong! The correct answer is {result}")
except ValueError:
print("Invalid input. Please enter a number.")
i += 1
end_time = time.time()
total_time = end_time - start_time
print("---------------------------------------")
print(f"You scored a total of {score} points")
if score >= 8:
print("\t\tYOU ARE BETTER THAN PRO, GO TRY THE MONK MODE🔥🔥🔥")
if score >= 5 and score < 8:
print("\t\tTRY AMATURE MODE NEXT TIME")
if score < 5:
print("\t\tYOU ARE WORST THAN I THOUGHT😂")
print(f"You took a total of {total_time:.2f} seconds")
elif choice == 3:
print(" ")
print("You've Entered: Monk Mode(HARDEST)🗿")
print(" ")
start_time = time.time()
score = 0
i = 0
while i < 10:
num1 = random.randint(100, 1000)
num2 = random.randint(101, 1000) # Make sure num2 is not zero for division
operation = random.choice(['+', '-', '*', '/'])
if operation == '+':
result = num1 + num2
elif operation == '-':
result = num1 - num2
elif operation == '*':
result = num1 * num2
elif operation == '/':
result = num1 / num2
answer = input(f"-> Problem {i+1}: {num1} {operation} {num2} = ")
# Validate the user's input
try:
if float(answer) == result:
print("Correct!")
score += 1
else:
print(f"Wrong! The correct answer is {result}")
except ValueError:
print("Invalid input. Please enter a number.")
i += 1
end_time = time.time()
total_time = end_time - start_time
print("---------------------------------------")
print(f"You scored a total of {score} points")
if score >= 8:
print("\t\tYOU ARE THE REAL MONK🔥🔥🔥")
if score >= 5 and score < 8:
print("\t\tTRY PRO MODE NEXT TIME")
if score < 5:
print("\t\tYOU ARE AMATURE, GO PLAY WITH TOYS")
print(f"You took a total of {total_time:.2f} seconds")
else:
print(" ")
print("---PROGRAM TERMINATED---")
exit()