Right now i have list of tuples as show below:
[(78, -32), (54, -32), (30, -32), (30, -8), (30, 16), (30, 40), (30, 64), (6, 64), (-18, 64), (-42, 64), (-66, 64), (-66, 88), (-90, 88), (-114, 88)]
My current codes are as such:
i = 13 # Let i start at index 13
tech = [] # Define list
while (x, y) != (start_x, start_y): # while loop to iterate through all the coordinates until the path has been found
tech.append(solution[x,y]) # Appends the coordinates to tech list
x, y = solution[x, y] # get x and y coordinates
for i in tech: # Loop thorugh each tuple
print(i) # Print each tuple
# time.sleep(1)
i -= 1 # Decrement the index
What i want to do is to print out the list in reverse order starting with the last tuple coordinates at the front and the first tuple coordinates at the back. The problem now is that when i try to decrement the index it throws this error:
unsupported operand type(s) for -=: 'tuple' and 'int'
Does anybody know why?