Question: Is this program a text file manipulation and explain why, and how it is used. OF this program? px_terms = int(input('Enter number of terms in
Is this program a text file manipulation and explain why, and how it is used.

OF this program?


px_terms = int(input('Enter number of terms in px: ')) qx_terms = int(input('Enter number of terms in qx: ')) import numpy # = px_terms = int(input('Enter number of terms in px: )) qx_terms = int(input('Enter number of terms in qx: ')) - poly = { = = for i in range(px_terms): #1. Repetition Structures ele = int(input('Enter coefficient {} for px: '.format(i + 1))) #if 'px' is not present already, add empty list with 'px' as key if 'px' not in poly: # 2. Decision Structures poly['px'] = [] # after adding empty list with 'px' as key, append input to the list #I added this line because it also add 1st coefficient to the list. poly['px').append(ele) #else, append input to the list else: poly['px'].append(ele) for i in range(qx_terms): #1. Repetition Structures ele = int(input('enter coefficient {} for qx: '.format(i + 1))) #if 'qx' is not present already, add empty list with 'qx' as key if 'qx' not in poly: # 2. Decision Structures poly['qx'] = [] = # after adding empty list with 'qx' as key, append input to the list. # I added this line because it also add 1 st coefficient to the list. poly['qx').append(ele) #else, append input to the list else: poly['qx').append(ele) = option = input('Select Addition, Subtraction, Multiplication, Division: '). if option.lower() == "addition": #2. Decision : Structures print(numpy.polynomial.polynomial.polyadd poly['px'], poly['qx'])) if option.lower() == "subtraction": = = print(numpy.polynomial.polynomial.polysub poly['px'], poly['qx'])) if option.lower() == "multiplication": total = 0 for i in range(px_terms): # 1. Repetition Structures ans = poly['px'][i] * poly['qx'][i] print(f"answer{i+1} = ", ans) total += ans print(f"total = {total}") if option.lower() == "division": qu, re = numpy.polynomial.polynomial.polydiv(poly['p x'], poly['qx']) print("Quotient: ", qu) print("Remainder:", re) =
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
