I have a list of tuples (of two length), and would like to iterate over both value and the index of the tuple in the list.
I have come up with a work around but I'm asking for is there a way to concentrate the defining of those variables into one line of for loop definition?
(or generally make the code look nicer)
example of desired output:
some_list = [(x1,y1),(x2,y2),(x3,y3),(x4,y4),(x5,y5)]
for index, x, y in some_list:
...
what I used instead:
some_list = [(x1,y1),(x2,y2),(x3,y3),(x4,y4),(x5,y5)]
for index, xy in enumerate(some_list):
for x,y in xy:
...