Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def TOH(n,A,B,C):
- if n>0:
- TOH(n-1,A,C,B)
- print('Moved disk',n,'from',A,'to',C)
- TOH(n-1,B,A,C)
- i = i + 1
- n=int(input("Enter How many disk:"))
- TOH(n,'A','B','C')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement