In [1]:
def hanoi(n,source,helper,target):
global A,B,C # this statement not necessary...why not?
if n==1:
target.append(source.pop())
print A, B, C
else:
hanoi(n-1,source,target,helper)
target.append(source.pop())
print A, B, C
hanoi(n-1,helper,source,target)
A=[5,4,3,2,1]
B=[]
C=[]
print A, B, C
hanoi(len(A),A,B,C)