Question: Write a new Python program which solves second degree polynomials through use of the quadratic equation. As a reminder, the quadratic equation gives two roots

Write a new Python program which solves second degree polynomials through use of the quadratic equation. As a reminder, the quadratic equation gives two roots x of a polynomial in the form The program should read the coefficients a, b , and c from an input file, where in each line in the file has the coefficients for an equation. The program must read the file and determine from what it reads how many cases are represented in the file. Then, the program should display both the polynomial with the coefficients filled in and the two roots for x that have been found. For text output, the carat symbol (^) can be used to represent exponents; thus, x2 can be written in the output as x^2. Your program should be made robust by trying to think ahead to what might go wrong. Where a possible problem could arise, you should use Pythons exception mechanism to try to prevent the program from crashing. Several of the things that might go wrong could include the wrong number of coefficients on a line of the input file, attempting to divide by zero, having a square root of a negative number, and so on. Possibly you can think of more. As much as you can, reduce your use of pre-written Python library code to the minimum.For example, rather than calling a built in Python function to find the square root, use a Write a new Python program which solves second degree polynomials through usefunction that you write which implements the algorithm given in an earlier lab this term.

Write a new Python program which solves second degree polynomials through use of the quadratic equation. As a reminder, the quadratic equation gives two roots x of a polynomial in the form f(X) = ax bvb.-4ac + bx + c as x = The program should read the coefficients a, b, and c from an input file, where in each line in the file has the coefficients for an equation. The program must read the file and determine from what it reads how many cases are represented in the file hen, the program should display both the polynomial with the coefficients filled in and the two roots for x that have been found. For text output, the carat symbol () can be used to represent exponents; thus, can be written in the output as x*2 Your program should be made robust by trying to think ahead to what might go wrong Where a possible problem could arise, you should use Python's exception mechanism to try to prevent the program include the wrong number of coefficients on a line of the input file, attempting to divide by zero, having a square root of a negative number, and so on. Possibly you can think of more from crashing. Several of the things that might go wrong could As much as you can, reduce your use of pre-written Python library code to the minimum For example, rather than calling a built in Python function to find the square root, use a function that you write which implements the algorithm given in an earlier lab this term

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!