I am trying to start and append new lists inside a loop using iterator. I tried to use dictionary idea from this answer.
Here is the snippet of my code, you can ignore the details of the code. If the if condition is satisfied I need to append values of i
in a specific list, which will be like patch12,patch53 etc:
import math as m
d = {}
for i in range(0,10):
for j in range(0, 10):
if((m.floor(vector[upper_leaflet[i],0:1]) <= xx[j][0]) & (m.floor(vector[upper_leaflet[i],0:1]) < yy[j][0])):
d["patch{}{}".format(xx[j][0],yy[j][0])].append(i)
Output should be something like if I print patch52 = [ 1, 5, 9 ,10]
What would be the correct way to do perform this?