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)

27th Jan 2019, 5:41 AM
Terry
Terry - avatar
2 Answers
+ 6
Hello Terry, Here is my solution: Just add print(equation(a, b, c)(x)) https://code.sololearn.com/cqsxST8Vo0p7/?ref=app
27th Jan 2019, 6:51 AM
just trying to think
just trying to think - avatar
+ 3
Try this: print(equation(a, b, c)(x))
27th Jan 2019, 6:50 AM
Diego
Diego - avatar