Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lst_one = [1, 2, 3, 4]
- iterable = 6
- lst_two = []
- while lst_one:
- i = iterable % len(lst_one)
- lst_two.append(lst_one[i])
- del lst_one[i]
- iterable += 1
- print(lst_one) # []
- print(lst_two) # [2, 1, 4, 3]
Advertisement
Add Comment
Please, Sign In to add comment