Programming-Idioms

History of Idiom 163 > diff from v4 to v5

Edit summary for version 5 :
New Python implementation by user [Oldboy]

Version 4

Version 5

Idiom #163 Print list elements by group of 2

Print all the list elements, two by two, assuming list length is even.

Idiom #163 Print list elements by group of 2

Print all the list elements, two by two, assuming list length is even.

Code
for x in zip(list_[::2], list_[1::2]):
    print(x)
Comments bubble
original list is called list_