-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmultiplications.py
executable file
·84 lines (76 loc) · 2.42 KB
/
multiplications.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
#!/usr/bin/python3
# Developer : Hamdy Abou El Anein
# hamdy.aea@protonmail.com
import random
from easygui import *
import sys
def start():
count = 1
bonne_rep = 0
max = 20
while count <= max:
number_a = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
number_b = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
random.shuffle(number_a)
random.shuffle(number_b)
print(str(count) + str(")"))
print(str(number_a[0]) + str(" X ") + str(number_b[0]) + str(" ="))
answer = int(input())
good_ans = int((number_a[0]) * (number_b[0]))
if good_ans == answer:
print("Bonne réponse ! Bravo !")
count = count + 1
bonne_rep = bonne_rep + 1
else:
print("Mauvaise réponse !")
print(("La réponse était :") + str(good_ans))
count = count + 1
bonne_rep = bonne_rep - 1
if bonne_rep <= 0:
bonne_rep = 0
if count > max:
break
total = ((bonne_rep) * 6) / 20
if total == 0:
total = 1
image = "./Pictures/sad.jpg"
msg = "Tu n'as pas réussi\n\nNote finale : " + str(total)
choices = ["Replay", "Quit"]
reply = buttonbox(msg, image=image, choices=choices)
if reply == "Replay":
start()
else:
sys.exit(0)
reply = buttonbox(msg, image=image, choices=choices)
elif total <= 3:
total = total + 1
image = "./Pictures/sad.jpg"
msg = "Tu n'as pas réussi\n\nNote finale : " + str(total)
choices = ["Replay", "Quit"]
reply = buttonbox(msg, image=image, choices=choices)
if reply == "Replay":
start()
else:
sys.exit(0)
elif total == 6:
image = "./Pictures/happy.jpeg"
msg = "Tu as réussi\n\nNote finale : " + str(total)
choices = ["Replay", "Quit"]
reply = buttonbox(msg, image=image, choices=choices)
if reply == "Replay":
start()
else:
sys.exit(0)
elif total > 4 and total < 6:
total = total + 1
if total > 6:
total = 6
image = "./Pictures/happy.jpeg"
msg = "Tu as réussi\n\nNote finale : " + str(total)
choices = ["Replay", "Quit"]
reply = buttonbox(msg, image=image, choices=choices)
if reply == "Replay":
start()
else:
sys.exit(0)
start()