I have different valued variables not in an array; e.g.
a = "united states"
b = "canada"
c = "mexico"
I also have similarly named variables with the same suffix
a_pop = 0
b_pop = 0
c_pop = 0
I have made a function to select randomly a
, b
or c
, but is there any way to edit the value of {selected value}_pop
(if a
then edit a_pop
's value, b
to b_pop
etc.) in a function without changing the previous variables of or using an tedious if/else ladder?
For example, a
is selected. Now (with a
selected) I want to add 1
to a_pop
's value.