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