To change a global variable inside a function we could proceed as follow:
let's say the global variable has 'x' as a name:
def change_x_globally( new_value ):
global x
x = new_value
such an approach requires to hardcode the name of the variable beforehand, in case of multiple global variables this approach becomes cumbersome and unpractical
so I would input the name of the global variable e.g: if we wanted to change x we would input the string "x"
hence the desired final function would have the following signature:
def change_global_variable( variable_name, new_value ):
pass
any ideas?