I am trying to write a code to iterate over columns in a datasheet and create variables depending on the number of columns. The variables will then be used in an optimization problem so I need the variables to not have any value assigned to them.
I created a list containing strings like list_w = ['w1', 'w2', ..... 'w35'] but I need these strings to act as variables.
This is what I tried to do based off some online resources but this doesn't work:
def objective(w):
for e in list_w:
f = list_w.index(e)
vars()[e] =w[f]
print(e)
return w1*w2*w3*w4