write a function called is_sorted that is given a list & returns true if the list is sorted otherwise false code example
Example: def is_sorted(stuff): for i in stuff: if stuff[i+1] > stuff[i]: return True else: return False numbers = [1, 0, 5, 2, 8] print is_sorted(numbers)
test_list = [1, 4, 5, 8, 10]
# printing original list
print ("Original list : " + str(test_list))
# using sorted() to
# check sorted list
flag = 0
if(test_list == sorted(test_list)):
flag = 1
# printing result
if (flag) :
print ("Yes, List is sorted.")
else :
print ("No, List is not sorted.")