[Tutor] lists
Abhi Singh
abhiedu.rkt at gmail.com
Fri Nov 27 16:11:18 EST 2020
Just loop over the list and compare every element with the previous one.
On Sat, 28 Nov 2020, 2:34 am Bernardo Rebelo, <
bernardoaugustorebelo11 at gmail.com> 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,
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list