You can go through the example given:
# using naive method to
# check sorted list
flag = 0
i = 1
while i < len(test_list):
if(test_list[i] < test_list[i - 1]):
flag = 1
i += 1
# printing result
if (not flag) :
print ("Yes, List is sorted.")
else :
print ("No, List is not sorted.")
Output :
Original list : [1, 4, 5, 8, 10]
Yes, List is sorted.