Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
a = [1, 2, 3, 4]
for x in range(0, len(a), 2):
pair = a[x:x+2]
print(pair)
... or individually ...
for x in range(0, len(a), 2):
print(str(a[x]) + ', ' + str(a[x+1]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment