I want to produce about 100 variables, each assigned to its own integer So for example, number_1=1,number_2=2,number_3=3 etc.. I have tried to use eval in the following way:
for x in range(1,101):
eval('number_'+str(x)) = x
I receive the error 'cant assign to function call'. I've also tried:
for x in range(1,101):
eval(('number_'+str(x)) = x)
Which gives the error 'keyword can't be an expression' Is there a way to do this? I am aware of the risks associated with eval and exec, but there is no user input or internet access in my code. Thanks!
Edit: This isn't the same as the other thread suggested, since here I'm trying to alter the name of the variable as well as its value.