c0d3

Pythonic way: 1

Here is how to check if a list is sorted in python.

all(l[i] <= l[i+1] for i in xrange(len(l)-1))
Advertisements