Rexilife
Rexilife

Reputation: 685

How can I make this variables change depending on a value?

how can I make the following variables acquire the name of the main variable next to them? (a,b,c,d) change depending on MainVariable?

MainVariable = 'Shoe'

a = blackShoe
b = whiteShoe
c = blueShoe
d = yellowShoe

and if it changes to for example 'Tie' then

a = blackTie
b = whiteTie
c = blueTie
d = yellowTie

Upvotes: 0

Views: 42

Answers (1)

grldsndrs
grldsndrs

Reputation: 308

 a,b,c,d = [s + MainVariable for s in [a,b,c,d]]

Upvotes: 1

Related Questions