Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
- for i, item in enumerate(a[1::2]):
- idx = i * 2;
- a[idx], a[idx + 1] = a[idx + 1], a[idx]
- print(a)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement