(Jun-16-2019, 05:42 PM)noisefloor Wrote: Hi,
@ppoyan89: iterating over an iterable withfor x in range(len(iterable))
is still a bad anti-pattern. Don't you have any motivation to use what you learned before?
Except this, this is solvable without iteration but by the build-in functionsorted
:
def is_sorted(iterable): return iterable == sorted(iterable)Regards, noisefloor
hi,
your code is only when you need to sort a list, and the question is basically asking you to see if the list is sorted return true otherwise false which doesn't work with your code