I want to dynamically name the list and use that,I searched a lot but did not get the satisfactory answers how to do that.
if __name__=="__main__":
lst_2017=[]
lst_2018=[]
lst_2019=[]
for year in range(2017,2020):
#avg_data is function which returns a list of number
lst_"{}".format(year) = avg_data()
Error:
File "<ipython-input-84-4c1fefedd83e>", line 9
lst_"{}".format(year) = avg_data()
^
SyntaxError: invalid syntax
Expected :
loop will iterate 3 times and function return the 3 list in the respective lists
example:
lst_2017=[1,2,4]
lst_2018=[3,4,5]
lst_2019=[3,4,6]