Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def move(frm, to, lst):
- """
- Moves an element in a list.
- frm: index to move element from
- to : index to move element to
- lst: the list to be updated
- """
- if to < frm:
- lst.insert(to, lst.pop(frm))
- elif frm < to:
- lst.insert(to+1, lst[frm])
- lst.pop(frm)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement