Skip to content

Commit e2d2cc3

Browse files
committed
Add gcd_value
1 parent bc84a25 commit e2d2cc3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

brain_games/games/gcd.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,19 @@ def get_nums_and_answer():
77
num_1 = get_random_num()
88
num_2 = get_random_num()
99
a, b = num_1, num_2
10+
gcd_value = ''
1011

11-
if b == 0:
12-
gcd = a
12+
if b == 0 or a == b:
13+
gcd_value = a
1314
else:
1415
remainder = a % b
1516
while remainder != 0:
1617
remainder = a % b
1718
a = b
1819
b = remainder
19-
gcd = a
20+
gcd_value = a
2021

21-
return f'{num_1} {num_2}', str(gcd)
22+
return f'{num_1} {num_2}', str(gcd_value)
2223

2324

2425
def run_gcd_game():

0 commit comments

Comments
 (0)