Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def from_src_to_dest (n, src_rod, dest_rod, aux_rod):
- if (n == 1):
- print ("Moving disk 1 from rod", src_rod, "to rod", dest_rod)
- return
- from_src_to_dest(n - 1, src_rod, aux_rod, dest_rod)
- print ("Moving disk", n,"from rod", src_rod, "to rod", dest_rod)
- from_src_to_dest(n - 1, aux_rod, dest_rod, src_rod)
- from_src_to_dest(5, 'A', 'C', 'B')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement