We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Numpy
- Polynomials
- Discussions
Polynomials
Polynomials
Sort by
recency
|
256 Discussions
|
Please Login in order to post a comment
My compact solution, easily a one-liner when ignoring the
import
statement…I see others cast
x
asfloat
. It worked fine for me asint
. Go figure!import numpy as np
print(np.polyval ((np.array(input().split(), float)) , (float(input()))))
Here is HackerRank Polynomials in Python solution - https://programmingoneonone.com/hackerrank-polynomials-problem-solution-in-python.html
import numpy as np
coeffs = list(map(float, input().split())) x = float(input())
result = np.polyval(coeffs, x) print(result)