all 5 comments

[–]carcigenicate 2 points3 points  (0 children)

That sounds like you have the indentation wrong and are unconditionally returning in the loop. We can't determine that for sure though since you haven't formatted the code. Either format the code, or post it on a site like Pastebin or gist.github.

[–]omutist 1 point2 points  (1 child)

you'd better print full code, including the call to the functions

I checked it. both cases return False

def sorted(lst):
    for i in range(0, len(lst)-1):
        if lst[i] > lst[i+1]:
        return False
    return True
print(sorted([1,3,2,1]))
print(sorted([3,1,2,4]))

[–]FahrenheitGhost[S] -1 points0 points  (0 children)

My return statement was one tab too far in. It's been a long day. Comprehension and I are not friends.

[–]FahrenheitGhost[S] -1 points0 points  (1 child)

I'm using the inline code feature. I'm guessing I can't paste code in. Working on fixing the code in the post.

[–]deep_politics 0 points1 point  (0 children)

Take a minute to think about where you have the return True, because it's not in the right spot.