Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2014
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.14 KB | None | 0 0
  1. a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
  2. for i, item in enumerate(a[1::2]):
  3.     idx = i * 2;
  4.     a[idx], a[idx + 1] = a[idx + 1], a[idx]
  5. print(a)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement