lets assum that i have list bellow
a = ['hello', 'banana', 'apple','foo','bar','blablabla']
that i want to declare for each list item in new variable then print those variables later, how ever the lengh of my list.
In my Case the output of the program should be like this, call each variable and the values inside it:
variable_0 = hello
variable_1 = banana
variable_2 = apple
variable_3 = foo
variable_4 = bar
variable_5 = blablabla
And here the clear solution :
dic={}
a = ['hello', 'banana', 'apple','foo','bar','blablabla']
i = 0
string="variable_"
while(len(a) > i):
dic.update({string+str(i):a[i]})
print(string+str(i)+" = "+a[i])
i+=1