LearnPy Hub
← Classes & Objects problems
Hard

Polynomial Class

Write class Poly built from coefficients (constant first). Give it degree() (ignoring trailing zero coefficients; the zero polynomial has degree 0) and __call__(x) to evaluate it. Read the coefficients and then x values; print the degree and then the value at each x.

Input

Coefficients; then x values.

Output

Lines.

Sample 1

Input
1 2 3
0 1 2
Output
2
1
6
17

Sample 2

Input
5
10
Output
0
5
solution.py
Output appears here
Polynomial Class · Python practice problem · LearnPy Hub