Skip to content

Commit 8b03c27

Browse files
committed
truediv returns an answer which is int() not float()
1 parent 2373cdf commit 8b03c27

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

main.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@ def operate(operation):
1212
num_1 = random.randint(1, 10)
1313
num_2 = random.randint(1, 10)
1414
answer = operators.get(operation)(num_1, num_2)
15+
1516
return answer,num_1,num_2
1617

1718
def random_problem():
18-
19-
20-
19+
2120
operation = random.choice(list(operators.keys()))
22-
2321
answer,num_1,num_2 = operate(operation)
22+
23+
while (operation=='/' and num_1<num_2) or (operation=='/' and answer!=num_1//num_2):
24+
print(str(answer))
25+
answer,num_1,num_2 = operate(operation)
2426

2527
print(f'What is {num_1} {operation} {num_2}')
2628
return answer

0 commit comments

Comments
 (0)