I have list of which I want to extract pairs of two consecutive numbers. The iterator should thus take two numbers and then skip and take the next pair:
a = [1,2,3,4,5,6]
Aim:
1 2
3 4
5 6
I wrote this little loop to do this...
for i in range(len(a)):
print('pair:', a[i], a[i+1])
... but this does not skip after a found pair:
pair: 1 2
pair: 2 3
pair: 3 4
pair: 4 5
pair: 5 6
Where do I miss the 'skipping' part in the loop or how could I solve this?