Discuss / Python / 交作业

交作业

Topic source

def hanoi(n, a, b, c):

if n == 1:

print(a, '-->', c)

else:

hanoi(n-1, a, c, b)

print(a, '-->', c)

hanoi(n-1, b, a, c)


  • 1

Reply