Discuss / Python / 作业

作业

Topic source

!/usr/bin/python3

""" from a move to c with b """ def move(n,a,b,c): if n<=0: print("Error") elif 1==n: print ("from %s move to %s"%(a,c)) else: move(n-1,a,c,b) move(1,a,b,c) move(n-1,b,a,c)

move(1,'A','B','C')

move(10,'A','B','C')


  • 1

Reply