[Tutor] lists
Mark Lawrence
breamoreboy at gmail.com
Fri Nov 27 16:46:11 EST 2020
On 27/11/2020 19:54, Bernardo Rebelo wrote:
> Hi I would like to know how to check if an element in a list is greater
> than the next element on the same list like this
>
> [5,4,3,2,1]
>
> if 5 > 4 > 3 > 2 > 1
> return True
>
> in an example like this one [5,4,5,2], it would give False.
>
> best regards,
Sorry but we don't write code for you, but to get you going you'll need
a 'for' loop and for best practice the 'enumerate' function
https://docs.python.org/3/library/functions.html#enumerate
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
More information about the Tutor
mailing list