+ 1
How can i dynamically create variables in python3?
what i want is, something like this, for x in range(1,6): variable'x' = input() in place of x there will be numbers and i'll have variables from variable1 to variable5.
1 Odpowiedź
+ 2
How about using lists?
my_inputs = [input() for x in somerange]
my_inputs[3] # some input
or with dictionaries...
my_inputs_dict = {'var'+str(i) : input() for i in somerange}
my_inputs_dict['var3']