Skip to content

Commit e72864f

Browse files
authored
Update recur.py
1 parent 0761de3 commit e72864f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

samples/function/recur.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ def fact(n):
1616
def move(n, a, b, c):
1717
if n == 1:
1818
print('move', a, '-->', c)
19-
return
20-
move(n-1, a, c, b)
21-
print('move', a, '-->', c)
22-
move(n-1, b, a, c)
19+
else:
20+
move(n-1, a, c, b)
21+
move(1, a, b, c)
22+
move(n-1, b, a, c)
2323

2424
move(4, 'A', 'B', 'C')

0 commit comments

Comments
 (0)