How to check if a list is strictly decreasing in Python

1 Answer

0 votes
def strictly_decreasing(lst):
    return all(x > y for x, y in zip(lst, lst[1:]))

lst = [89, 70, 44, 32, 25, 19, 18, 7, 5, 3, 1]

print(strictly_decreasing(lst))




'''
run:

True

'''

 



answered Feb 22, 2024 by avibootz

Related questions

1 answer 187 views
1 answer 139 views
1 answer 117 views
1 answer 155 views
1 answer 163 views
...