Say I have the following string
a = "x**2+5"
and I want to use it to create the following lambda function:
b= lambda x: x**2+5
How do I do so?
You can use eval(): b = lambda x: eval(a). Just remember that using eval() in a real program, where you do not have control over a and x, may cause tons of problems.