def is_sorted(xs):
acc = True
for i in range(len(xs) - 1):
acc = acc and (xs[i] <= xs[i + 1])
# accumulate the truthiness of whether the list sorted
return acc # True if all the comparisons were true
def is_sorted(xs):
for i in range(len(xs) - 1):
if xs[i] > xs[i + 1]:
return False
# we only get to this point if we never returned False
return True