Question: Python 3.6 Create program which solves second degre polynomials by using quadratic equation that finds two roots of x. l in Quadratic equation: f(x) =

Python 3.6

Create program which solves second degre polynomials by using quadratic equation that finds two roots of x. l in

Quadratic equation: f(x) = ax2 + bx + c as x = ((bb24 a c )/ (2a))

The program should read the coefficients a, b, and c from an input file (shown below). Each line in the txt file has the coefficients for an equation. The program must read that file and determine from what it reads how many test cases are represented in the file.The program must 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 function that you write.

Do these test cases with exceptions (shown below): no 3 variables, one variable is a letter instead of number, if if (b^2 -4ac) = 0 , if (b^2 -4ac) is less than 0, and if a = 0.

5 7 1 f(x)= 5x^2 + 7x + 1, with x intercepts at (-1 , 24, 0 ) and (-0,16,0) 6 10 9 f(x)= 6x^2 + 10x + 9 which has no x-intercepts 8 20 10 f(x) = 8x^2 + 20x+ 10 with x intercepts at (-1, 81,0) and (-0,69,0) 100 600 600 63 wrong amt of coefficients 1 1 1 f(x) =1x^2 +1x +1 which has no x intercepts 5 6 a invalid coefficeints/ constant 62 wrong amount of coefficients 0 5 6 f(x) = 0x^2 +5x+ 6 ,w which only has x intercept at (-1, 2, 0) 1 2 1 f(x) = 1x^2 +2x+1 which only has x intercept at (-1,0,0) -9 -5 -5 f(x) = -9x^2 + -5x + -6, which has no x-intercepts 

The first line represents numbers in the txt file (illustration shown below) . The second line is what should be displayed in the output after creating the program.

Python 3.6 Create program which solves second degre polynomials by using quadratic

Please show source code with indentation. And screenshot the output. Thanks

quadratic.txt x 5 7 1 6 10 9 8 20 10 100 600 600 63 2 (3 9 10 62 0 5 6 1 2 1

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!