汉诺塔

def hannuo(x,a,b,c):
    if x == 1:
        print(a,"->",c)
    else:
        hannuo(x-1,a,c,b)
        print(a,"->",c) 
        hannuo(x-1,b,a,c)
x = int(input())
hannuo(x,"A","B","C")
原文地址:https://www.cnblogs.com/Glzt/p/12617405.html