So I have a list of variables (all being integers). I would want to randomly choose one of these variables, but make it so that it returns the actual variable, not the value.
for example:
list = [a, b, c, d]
(with all of them equal to 0)
print(random.choice(list))
would return 0, while I want it to return a, b, c or d;
So that if I write :
random.choice(list) += 2
It would update one of these variables.
Aucun commentaire:
Enregistrer un commentaire