-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path__init__.py
More file actions
74 lines (63 loc) · 2.21 KB
/
__init__.py
File metadata and controls
74 lines (63 loc) · 2.21 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
from suma import suma
from resta import resta
from multi import multiplicacion
from divicion import division
from potencia import potencia
from modulo import modulo
def game():
score = 0
while True:
print('======== Menu ========')
print('\n1. Jugar')
print('\n0. Exit')
option = int(input('\nChoice an option: '))
if option == 0:
break
num_1 = int(input('Enter first number: '))
num_2 = int(input('Enter second number: '))
answerS = int(input('Enter your answer for Suma: '))
resultS = suma(num_1, num_2)
if resultS == answerS:
score += 1
print('Correct for suma!')
else:
print('Incorrect for suma')
answerR = int(input('Enter your answer for Resta: '))
resultR = resta(num_1, num_2)
if resultR == answerR:
score += 1
print('Correct for Resta!')
else:
print('Incorrect for resta')
answerM = int(input('Enter your answer for multiplicacion: '))
resultM = multiplicacion(num_1, num_2)
if resultM == answerM:
score += 1
print('Correct for multiplicacion')
else:
print('Incorrect for multiplicacion')
answerD = int(input('Enter your answer for division: '))
resultD = division(num_1, num_2)
if resultD is not None and resultD == answerD:
score += 1
print('Correct for division!')
else:
print('Incorrect for division')
answerP = int(input('Enter your answer for potencia: '))
resultP = potencia(num_1, num_2)
if resultP == answerP:
score += 1
print('Correct for potencia!')
else:
print('Incorrect for potencia')
answerO = int(input('Enter your answer for modulo: '))
resultO = modulo(num_1, num_2)
if resultO is not None and resultO == answerO:
score += 1
print('Correct for modulo!')
else:
print('Incorrect for modulo')
print(f'======== Game Over ========')
print(f'\nYour score is {score}')
print('Keep going!')
game()