Skip to content

Commit b8d7a3c

Browse files
authored
Add files via upload
1 parent 8cf8642 commit b8d7a3c

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

mathgame.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Game Project BETA 1.0
2+
import os, random, time, sys
3+
4+
def loadingbar():
5+
for i in range(21):
6+
sys.stdout.write('\r')
7+
# the exact output you're looking for:
8+
sys.stdout.write("[%-20s] %d%%" % ('=' * i, 5 * i))
9+
sys.stdout.flush()
10+
time.sleep(0.67)
11+
12+
13+
def gamepartystart():
14+
print("Hi Player Please wait to connect you to the game !")
15+
loadingbar()
16+
print("Done")
17+
game()
18+
19+
def game():
20+
game_games = int(input("How Many partys do you want : "))
21+
g = game_games
22+
choices_forgame = ["-", "+", "*", "/"]
23+
points = 0
24+
while 0 < game_games:
25+
number_1 = random.randint(0,10)
26+
mut = random.choices(choices_forgame)
27+
number_2 = random.randint(1,10)
28+
mut = ' '.join([str(elem) for elem in mut])
29+
30+
finalinput = float(input(f"{number_1} {mut} {number_2} = "))
31+
if mut == "-":
32+
x = number_1 - number_2
33+
elif mut == "+":
34+
x = number_1 + number_2
35+
elif mut == "*":
36+
x = number_1 * number_2
37+
elif mut == "/":
38+
x = number_1 / number_2
39+
if finalinput == x:
40+
41+
print("True +")
42+
43+
points += 1
44+
else:
45+
print("False -")
46+
game_games -= 1
47+
48+
iQ = points / g
49+
if iQ < 0.3:
50+
grade = f"F IQ = {(iQ * 100 * points / g) + 30 }"
51+
elif iQ < 0.5 and iQ >= 0.3:
52+
grade = f"E IQ = {(iQ * 100 * points / g) + 30 }"
53+
elif iQ < 0.6 and iQ >= 0.5:
54+
grade = f"D IQ = {(iQ * 100 * points / g) + 30 }"
55+
elif iQ < 0.7 and iQ >= 0.6:
56+
grade = f"C IQ = {(iQ * 100 * points / g) + 30}"
57+
elif iQ < 0.9 and iQ >= 0.7:
58+
grade = f"B IQ = {(iQ * 100 * points / g) + 30}"
59+
elif iQ >= 0.9 and iQ < 1:
60+
grade = f"A IQ = {(iQ * 100 * points / g) + 30}"
61+
else:
62+
grade = f"S IQ = {(iQ * 100 * points / g) + 30}"
63+
print(f"You got a {points}/{g} *" + grade)
64+
65+
66+
67+
gamepartystart()

0 commit comments

Comments
 (0)