Answer to Question #255688 in Python for chethan

Question #255688
Given polynomial write a prigram that prints polynomial in Cix^Pi + Ci-1x^Pi-1....+C1x+C0 format.


sample input:

4

0 5

1 0

2 10

3 6

sample output:

6x^3 + 10x^2 + 5


1
Expert's answer
2021-10-27T16:24:10-0400
def Polynomial(p, n):
    for i in range(n):
        print(p[i], end="")
        if (i != 0):
            print(" x^", i, end="")
        if (i != n - 1):
            print(" + ", end="")

if __name__ == '__main__':
    print(Polynomial([3, 2, 6, 11], 8))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS