How to select increasing elements of a list of tuples?

Viewed 155

I have the following list of tuples:

a = [(1, 2), (2, 4), (3, 1), (4, 4), (5, 2), (6, 8), (7, -1)]

I would like to select the elements which second value in the tuple is increasing compared to the previous one. For example I would select (2, 4) because 4 is superior to 2, in the same manner I would select (4, 4) and (6, 8).

Can this be done in a more elegant way than a loop starting explicitly on the second element ?

To clarify, I want to select the tuples which second elements are superior to the second element of the prior tuple.

4 Answers
Related