jess
0
Q:

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.")
0

New to Communities?

Join the community