Monday, September 20, 2010

Pythonic way to check if a list is sorted or not

Programmer Question

Is there a pythonic way to check if a list is already sorted in AESC or DESC.



listTs=[1,2,3,5,6,7]



something like listTs.isSorted() that returns True or False.



EDIT: I want to input a list of timestamps for some messages and check if the the transactions appeared in the correct order.



and I can write a custom function too :) , Thanks



Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails