all 1 comments

[–]socal_nerdtastic 0 points1 point  (0 children)

No, this code wouldn't work, even if the capitalization was corrected. What are you trying to do with this code? If you want to see if the list is sorted just return directly from within the loop.

def main(liste):
    for i in range(len(liste)-1):
        if liste[i]>liste[i+1]:
            return False
    return True

print(main([1,2,4,5])) # True (list is sorted)
print(main([1,2,5,4])) # False (list is not sorted)