I have a list: test = ['0to50', '51to100', '101to200', '201to10000']
I want to create the following four variables using a for loop:
var_0to50
var_51to100
var_101to200
var_201to10000
I tried the following code:
test = ['0to50', '51to100', '101to200', '201to10000']
for i in test:
print (i)
var_{i} = 3
But it gives me error:
File "<ipython-input-76-58f6edb37b90>", line 6
var_{i} = 3
^
SyntaxError: invalid syntax
What am I doing wrong?