python - TypeError: 'function' object is not subscriptable in sorting algorithm -
i creating program in python designed organise list, have been using insertion sort method, when execute program, after have input list top organise, returned error "typeerror: 'function' object not subscriptable"
code below:
def listsort(x): in range(1,len(list)): value = list[index] = index - 1 while i>=0: if value < list[i]: list[i+1] = list[i] list[i] = value = - 1 else: break
please me understand have gone wrong here people, it's frying brain....
list()
python function.
you can't index functions.
considering using different variable name. (like x
since seems list trying sort)
it's worth noting sort()
, sorted()
functions may use, learning sorting methods practice.
Comments
Post a Comment