-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdditionTrainer.py
More file actions
174 lines (142 loc) · 4.35 KB
/
Copy pathAdditionTrainer.py
File metadata and controls
174 lines (142 loc) · 4.35 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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
import random
score = 0
score = int(score)
name = input("What is your name? ")
name = name.title()
print("\n")
print("""Hello {}, We will going to present 10 questions.
Enter the appropriate answer to each question. Good luck!""".format(name))
print("\n")
import sys
def areYouReady():
answer = input("Do you want to start now? ").upper()
if answer == "YES":
print("\n")
print("THE GAME STARTS NOW. ")
print("\n")
elif answer == "NO":
print("Thank you for visiting!")
sys.exit()
return answer
areYouReady()
#item1
addend1 = random.randint(0,99)
addend2 = random.randint(0,99)
print("1. ", str(addend1), "+", str(addend2), "= ?")
answer1 = int(input("Your answer is: "))
if(addend1 + addend2 == answer1):
print("Well done! that is correct!")
score = score + 1
else:
print("Sorry, that is not correct")
print("Your current score is " + str(score) + " out of 10")
print("\n")
#item2
addend1 = random.randint(0,99)
addend2 = random.randint(0,99)
print("2. ",str(addend1), "+", str(addend2), "= ?")
answer1 = int(input("Your answer is: "))
if(addend1 + addend2 == answer1):
print("Well done! that is correct!")
score = score + 1
else:
print("Sorry, that is not correct")
print("Your current score is " + str(score) + " out of 10")
print("\n")
#item3
addend1 = random.randint(0,99)
addend2 = random.randint(0,99)
print("3. ",str(addend1), "+", str(addend2), "= ?")
answer1 = int(input("Your answer is: "))
if(addend1 + addend2 == answer1):
print("Well done! that is correct!")
score = score + 1
else:
print("Sorry, that is not correct")
print("Your current score is " + str(score) + " out of 10")
print("\n")
#item4
addend1 = random.randint(0,99)
addend2 = random.randint(0,99)
print("4. ",str(addend1), "+", str(addend2), "= ?")
answer1 = int(input("Your answer is :"))
if(addend1 + addend2 == answer1):
print("Well done! that is correct!")
score = score + 1
else:
print("Sorry, that is not correct")
print("Your current score is " + str(score) + " out of 10")
print("\n")
#item5
addend1 = random.randint(0,99)
addend2 = random.randint(0,99)
print("5. ",str(addend1), "+", str(addend2), "= ?")
answer1 = int(input("Your answer is :"))
if(addend1 + addend2 == answer1):
print("Well done! that is correct!")
score = score + 1
else:
print("Sorry, that is not correct")
print("Your current score is " + str(score) + " out of 10")
print("\n")
#item6
addend1 = random.randint(0,99)
addend2 = random.randint(0,99)
print("6. ",str(addend1), "+", str(addend2), "= ?")
answer1 = int(input("Your answer is: "))
if(addend1 + addend2 == answer1):
print("Well done! that is correct!")
score = score + 1
else:
print("Sorry, that is not correct")
print("Your current score is " + str(score) + " out of 10")
print("\n")
#item7
addend1 = random.randint(0,99)
addend2 = random.randint(0,99)
print("7. ",str(addend1), "+", str(addend2), "= ?")
answer1 = int(input("Your answer is: "))
if(addend1 + addend2 == answer1):
print("Well done! that is correct!")
score = score + 1
else:
print("Sorry, that is not correct")
print("Your current score is " + str(score) + " out of 10")
print("\n")
#item8
addend1 = random.randint(0,99)
addend2 = random.randint(0,99)
print("8. ",str(addend1), "+", str(addend2), "= ?")
answer1 = int(input("Your answer is: "))
if(addend1 + addend2 == answer1):
print("Well done! that is correct!")
score = score + 1
else:
print("Sorry, that is not correct")
print("Your current score is " + str(score) + " out of 10")
print("\n")
#item9
addend1 = random.randint(0,99)
addend2 = random.randint(0,99)
print("9. ",str(addend1), "+", str(addend2), "= ?")
answer1 = int(input("Your answer is: "))
if(addend1 + addend2 == answer1):
print("Well done! that is correct!")
score = score + 1
else:
print("Sorry, that is not correct")
print("Your current score is " + str(score) + " out of 10")
print("\n")
#item10
addend1 = random.randint(0,99)
addend2 = random.randint(0,99)
print("10. ",str(addend1), "+", str(addend2), "= ?")
answer1 = int(input("Your answer is: "))
if(addend1 + addend2 == answer1):
print("Well done! that is correct!")
score = score + 1
else:
print("Sorry, that is not correct")
print("\n")
print("Your total score is " + str(score) + " out of 10")
print("Thank you for playing {}, goodbye!".format(name))