Skip to content

Commit 06d8db8

Browse files
committed
fix gcd logic
1 parent 71aa9b8 commit 06d8db8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

brain_games/games/b_gcd_logic.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@ def b_gcd():
1414
while ngin.counter < 3:
1515
print(f'Question: {a} {b}')
1616
answer = prompt.string('Your answer: ')
17+
if b == 0:
18+
gcd = a
19+
elif a == 0:
20+
gcd = b
1721
while b != 0:
1822
if max(numbers) % min(numbers) == 0:
1923
gcd = min(numbers)
2024
rem = a % b
2125
a = b
2226
b = rem
23-
24-
if b == 0:
25-
gcd = a
2627
if answer == str(gcd):
2728
print('Correct!')
2829
a = randint(0, 20)

0 commit comments

Comments
 (0)