Advertisement
Guest User

Milikantsi_tower

a guest
May 23rd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. def milikantsi(amount,tower_1,tower_2,tower_3):
  2. print(tower_1,tower_2,tower_3)
  3. if amount > 0:
  4. milikantsi(amount-1,tower_1,tower_3,tower_2)
  5. if tower_1:
  6. tower_3.append(tower_1.pop())
  7. milikantsi(amount-1,tower_2,tower_1,tower_3)
  8.  
  9. n=int(input())
  10.  
  11. tower_1=[i for i in range(n)]
  12. tower_2=[]
  13. tower_3=[]
  14. milikantsi(len(tower_1),tower_1,tower_2,tower_3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement