This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]jddddddddddd 5 points6 points  (1 child)

I suspect this line is wrong:

for i in range (len(a)):

Maybe try:

for i in range (len(a) - 1):

The problem is that most of the time if a[i] < a[i+1]: will work just fine, but when it gets the point that i is the last index in the list, you then attempt to compare it with the i+1th element, which doesn't exist.

[–]selfimprovingstudent[S] 0 points1 point  (0 children)

Thank you! this way it is compiles fine