For a school project about artificial intelligence, I need to be able to connect a function name to another function like this for example:
def b_test(x):
return x+1
def a_test(x):
return x
variable = "b"
variable+= "_test"
a_test = variable
I guess that Python wants to use the name "b" as the new name/alias of the function a_test instead of using b_test as the new name.
So how can I force python to look what b means instead of just using it?
EDIT:
What I want to do is :
I have in my variable variable
the string b
and I need to, when I use in my code a_test(x)
, return x+1 (the return of the function b_test
). So I add the string "_test" to variable so it is "b_test".
I could do it by coding
a_test = b_test
but I won't only connect a_test to b_test, it might be c_test or d_test, that's why I need to use a variable.