How to check if all strings in a list of strings are in ascending order with Python

1 Answer

0 votes
lst = ["c", "c++", "java", "python"]

ascendingorder = all(s < nexts for s, nexts in zip(lst, lst[1:]))

print(ascendingorder)



'''
run:

True

'''

 



answered Aug 13, 2023 by avibootz
...