Write a program that accepts two polynomials as input and displays the resultant polynomial after multiplication of input polynomials
# Function to multiply two polynomials
def multiply_polynomials(poly1, poly2):
result_degree = len(poly1) + len(poly2) - 2 # Degree of the resultant polynomial
# Initialize the coefficients of the resultant polynomial with zeros
result_coeffs = [0] * (result_degree + 1)
# Multiply the coefficients of the input polynomials
for deg1, coeff1 in enumerate(poly1):
for deg2, coeff2 in enumerate(poly2):
result_coeffs[deg1 + deg2] += coeff1 * coeff2
return result_coeffs
# Function to display a polynomial in a readable format
def display_polynomial(polynomial):
degree = ______ ___ ______ _____ ________ ____.
_______ _____ ______ ___ ___ ________ ________.
_____ _______ __________ _______ ______ ___ __________ ______ _________ ___.
_______ _________ ______ _________ _____ __________ ______ __________ ______.
________ ____ _______ ___ _____ _____ ___ __________ ____ __________ ______.
________ ___ ________ _________ ____ ______ _______ ____ ____ ______ __________.
_____ __________ ________ _______ ______ ____ _____ _____ _______ _____.
___ _____ ___ _________ ____ _________ ______ __________.
____ _____ _____ _______ ________.
___ ________ ______ _____ ______ __________ ________ ___ ___ _______ ____ ______.
________ ______ _____ ___ _______ _______ ____ _______.
_____ ______ ________ ____ ___ ________ ____ __________ _____.
________ _________ ________ ____ _________ _________ _____ _____ ______ ______ ___.
_____ ________ ___ ______ ________.
______ _____ ___ __________ _____ _________.
_______ ______ __________ ______ ____ ___ ___ _________ ___ _____.
_________ _____ ________ _____ ________ __________.
_________ ________ ____ _____ _______ ____ ____ ______ _____ _________ _____ _____.
___ ________ ________ _________ ______ ___ __________ _____ ___ _____.
____ _______ _____ __________ _______ _______ _______ ______ ________ _____ ______.
___ ___ _________ _________ ________.
_______ _______ ___ ______ ________ ________ ____ ________ ________ ____.
___ _________ _____ _______ _____.
______ _____ ________ _____ __________ __________ _____ ____ ___.
_________ _____ __________ _________ __________ _____.
______ _____ _____ ____ ___ ___ _______ ______.
_________ ________ ___ ___ _________ ________ ___.
______ _____ _______ ____ __________ _________ _____ _______ ______ _____ ____.
________ ____ _________ ________ _____ _____ ____.
_____ ________ ___ _______ ______ ________.
____ ____ _________ _________ _______ __________.
________ ________ _____ ______ __________ ___ ___.
_____ _________ ______ __________ _________.
_________ ______ ___ _____ _____ ____.
__________ ________ _________ _______ __________.
_____ _________ ______ ________ _______ ______ ______ ____.
_________ ____ ___ _________ _______ _______ ______ _________ _________ _____.
________ ___ ______ _________ _____ ________.
____ ________ _________ __________ ____ ___ ____ ______ __________.
_____ _________ ________ ___ ___ ___ ____ _______ __________.
________ ____ ____ _______ _______ _______ ________ ____.
__________ ________ _________ ________ _________ ______ ____.
________ _________ _______ _________ ______ _________ ___ _______ _________ _______ _______.
____ _____ _______ ________ _______ _________.
__________ __________ _________ _________ ____ _______ _________ ______ __________.
__________ _____ _________ ______ ____ _________ _______.
____ ________ _____ _______.
Get Full Answer on WhatsApp