汉诺塔(hanoi) 汉诺塔代码: def hanoi(n,x,y,z): if n == 1: print(x,'-->',z) else: hanoi(n-1,x,z,y) print(x,'-->',z) hanoi(n-1,y,x,z) n = int(input('Input your number:')) hanoi(n,'X','Y','Z') Published by 风君子 独自遨游何稽首 揭天掀地慰生平 View all posts by 风君子