How can I parse a string input into the proper form for it to be executed as mapping regulation in a lambda function?
fx=type(input("Enter a polynomial: "))
This is my input, I want to enter arbirtray polynomials.
f= lambda x: fx
Now i want my lambda function to be able to execute the strings from the input function just as if they were normal mapping regulations like x**2
for instance.
fx
, then parse it into a new string format that can be evaluated more easily? Or do you want a function that evaluates that string and can be used in another, lambda function? Or something else? I hope you realize that your lambda expression as written is meaningless.fx
will always bestr
, unless you're using Python 2.x.