I have a following list lst = [100,200,300,400]
I need the following output [(100, 200), (200, 300), (300, 400)]
I did some research and used itertools.combinations library for that
[c for c in itertools.combinations(lst, 2)]
if I use the above code I get the following output which produces all combinations. [(100, 200), (100, 300), (100, 400), (200, 300), (200, 400), (300, 400)]
I don't want all the combinations, I only want forward moving combinations how can I get the desired output?