listing efficient implementation of the polynomial add operation class polynomial def __add__selfrhspoly )assert self degree(> and rhspoly degree(> "addition only allowed on non-empty polynomials newpoly polynomial(nodea self _termlist nodeb rhspoly _termlist add corresponding terms until one list is empty while nodea is not none and nodeb is not none if nodea degree nodeb degree degree nodea degree value nodea coefficient nodea nodea next elif lista degree listb degree degree nodeb degree value nodeb coefficient nodeb nodeb next else degree nodea degree value nodea coefficient nodeb coefficient nodea nodea next nodeb nodeb next self _appendtermdegreevalue if self list contains more terms append them while nodea is not none self _appendtermnodea degreenodea coefficient nodea nodea next or if rhs contains more terms append them while nodeb is not none self _appendtermnodeb degreenodeb coefficient nodeb nodeb next return newpoly multiplication computing the product of two polynomials requires multiplying the second polynomial by each term in the first this generates series of intermediate polynomialswhich are then added to create the final product to aide in this operationwe create second helper methodtermmultiply()as shown in lines - of listing which creates new polynomial from multiplying an existing polynomial by another term using this helper methodwe can now easily create solution for the multiplication operation that simply implements the individual steps outlined earlier for multiplying two polynomials as with the earlier simple add(methodthis