I know its possible to declare dynamic variables using this method :
for x in range(0, 7):
globals()[f"variable1{x}"] = x
What i want to do is something like :
ls = [1,31,42,56, ...]
for x in range(0, len(ls)):
globals()[f"variable{x}"] = 10*x if ls[x] %2 == 0 else globals()[f"variable{x}"] = 11*x
Code is random beacause i tried to make it as simple as possible, apologies.
What i am actually trying to do is :
for i in range(0,4):
globals()[f"numb{i}"] = tk.Label(root, text=(best[i] +"\n"+dates[0]),width=10,height=3, bg="#F4F5B7") if len(best) >= i else tk.Label(root, text=('UNDEFINED'),width=10,height=3, bg="#F4F5B7")
numb[i].grid(row=1,column=(i+5))
Where best[]
is user inputed