I have a list 'x' consisted of some numbers and ideally I wish to obtain a list like 'a'
x = [12, 37, 64, 159, 205, 225, 239, 252, 257]
a = [(12,37),(37,64),(64,159),(159,205),(205,225),(225,239),(239,252),(252,257)]
I have the following code but it does not seem to do the right thing:
for i in zip(x[::2], x[1::2]):
print(i)
I got the results like:
(12, 37)
(64, 159)
(205, 225)
(239, 252)