0
Python: adding value to equation to make lambda working
For the function below it works def equation(a, b, c): return lambda x: a*x**2+b*x+c equation(2,2,2)(2) But how do you allow users to input values as a, b, c and x? I've tried putting the below but it didn't work but getting an error def equation(a, b, c): return lambda x: a*x**2+b*x+c a = int(input()) b = int(input()) c = int(input()) x = int(input()) print(equation)
2 odpowiedzi
+ 6
Hello Terry,
Here is my solution:
Just add print(equation(a, b, c)(x))
https://code.sololearn.com/cqsxST8Vo0p7/?ref=app
+ 3
Try this:
print(equation(a, b, c)(x))