nested Variable
>>> a_variable = 1
>>> q_variable = 2
>>> def stats(choice):
... globals()[f'{choice}_variable'] +=1
...
>>> stats('a')
>>> a_variable
2
>>> stats('a')
>>> a_variable
3
>>> stats('q')
>>> q_variable
3
>>> a_variable = 1
>>> q_variable = 2
>>> def stats(choice):
... globals()[f'{choice}_variable'] +=1
...
>>> stats('a')
>>> a_variable
2
>>> stats('a')
>>> a_variable
3
>>> stats('q')
>>> q_variable
3
No Comments