I am trying to add the third element of every sub list together in my 2 dimensional list. I have tried this.
total_order = [['Steve', 45, 6],['Miranda', 56, 3],['Alice', 34, 8]]
total_cost = 0
for i in total_order:
total_cost += total_order[i][2]
i += 1
I am receiving this error:
TypeError: list indices must be integers or slices, not list