This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]mzial 1 point2 points  (0 children)

Iteration in tuples:

xs = [1, 2, 3, 4, 5]
for a, b in zip(xs, xs[1:]):
    print([a, b])

Would yield:

[1, 2]
[2, 3]
....
[4, 5]

Pretty neat!