I'm looking to assign items to variables using a loop, where the names of the variables are already predetermined from a list. I've got a list set up, and I'm having issues within the loop. My code is similar to this:
dict_Name = { 'a', 'b', 'c', ... , 'k', 'l'}
for input_x in list_Name:
dict_Name['self.var_'+input_x] = round(float(eval('self.ui.inp_'+input_x).text()), 2)
print ('self.var'+input_x)
Where the dictionary goes from 'a' to 'l'. Here, the rounded floating number is coming from user input (GUI created with PyQt) where the input value name is "inp_a", for example. I'm looking to assign the "inp_a" value to "var_a", but I'm having trouble with this.
The current error is that the " 'set' object does not support item assignment". I'm assuming this means I can't use the dictionary tool to assign variables from the user input, but I'm not sure about that.
Any help is much appreciated.