I have a number of global variables in my script (e.g. group_1, group_2, group_3) and I am trying to refer to them inside a function.
def plot(group_number):
return(f"group_{group_number}")
I would like the function in this case to return the global variable group_2 when I run plot(2)
. Is there a way to turn this string "group_2" into the variable group_2
?