So I want to sort a list of namedtuples using insertion sort in python, and here is my code.
def sortIt(tripods):
for i in range(1, len(tripods)):
tmp = tripods[i][3]
k = i
while k > 0 and tmp < tripods[k - 1][3]:
tripods[k] = tripods[k - 1]
k -= 1
tripods[k] = tmp
Whenever it runs it gives me a TypeError: int object is not suscriptable. Tripods is a list of namedTuples and the index 3 of the namedTuple is what I want the list to be ordered by.
tripods[k] = tmpassign totripods[k]? What will happen next time you examinetripods[k]?