Is there a pythonic way to check if a list is already sorted in ASC or DESC
listtimestamps = [1, 2, 3, 5, 6, 7]
something like isttimestamps.isSorted() that returns True or False.
I want to input a list of timestamps for some messages and check if the the transactions appeared in the correct order.
Here is a one liner:
If using Python 2, use
xrangeinstead ofrange.For
reverse=True, use>=instead of<=.