汉诺塔问题
#汉诺塔问题 count=0 def hannuo(n,scr,dst,mid): global count if n==1: print("{}:{}->{}".format(1,scr,dst)) count+=1 else: hannuo(n-1,scr,mid,dst) print("{}:{}->{}".format(n,scr,dst)) count+=1 hannuo(n-1,mid,dst,scr) hannuo(4,"a","b","c") print(count)