I have a set of years like that:
years = [2020,2021,2022]
and I also have a dictionary that links the sites available in each year(sit_available_year), that looks like following :
2020 -> [ "site1","site2,"site3] 2021 -> [ "site1","site3"]
I’d like to create a dictionary that seems like that:
myDict= Dict(((site,y)) => value1 for y in years, site in sit_available_year[y])
the keys of my dictionary it will be then:
[ "site1", 2020] => value1 [ "site2", 2020] => value1 [ "site1", 2021] => value1
I have tried that syntax above but it doesn’t work. I got an error that says that y is not defined.
Anyone has an idea what’s the right syntax to use? Thanks in advance.