0

Not sure of the correct terminology for this so I'll give an example...

Light1 = 1000
Light2 = 2000
Light3 = 3000
min1 = 500
max1 = 5000
min2 = 400
max2 = 4000
min3 = 600
max3 = 6000

for x in range(3):
    lt'x+1' = (Light'x+1'-min'x+1')/(max'x+1'-min'x+1')

I'm trying to get the value of the 'x+1' part to become part of the statement so I don't have to manually type out each assignment. This has to be possible right?

I'm trying to get lt1, lt2 and lt3 get assigned automatically using the for loop.

  • 1
    You should use a ``dict`` instead, it will make your live so much easier, than trying to build "dynamic" variables. – Mike Scotty Nov 29 '17 at 21:13
  • Actually I'd group it differently: something1 = (1000, 500, 5000), something2 = (2000, 400, 4000), something3 = (3000, 600, 6000) and iterate over [something1, something2, something3]... – Marcin Pietraszek Nov 29 '17 at 21:17
  • Thanks for the comments and links. I was trying to iterate over non-iterables. Making all of my variables and properties into lists or dicts was key. – Jim Wicklund Dec 01 '17 at 14:10

0 Answers0