Question: Excercise # 3 Write a python code that solve quadratic equation ax? + bx+c= 0. The quadratic equation can have either one or two distinct

Excercise # 3 Write a python code that solve quadratic equation ax? + bx+c= 0. The quadratic equation can have either one or two distinct real solutions, or has no real solution. Based on the value of the discriminant 62 - 4ac of the quadratic equation there are three cases: . If this discriminant is positive, then there are two distinct solutions. -b+ va ---- V 2a 2a , and Where d is is discriminant of the quadratic equation. If the discriminant is zero, then there is exactly one real solution. b 2a If the discriminant is negative, then the equation has no real solution. . You should provide the following functions: . def main(): function that do the following: . Prompts the user to enter the a, b and c o Then, calls the solveQuadratic() function to solve the quadratic equation. def solveQuadratic(a,b,c): This function calculates the discriminant: b2 - 4ac and using its value to call one of the following funtions: def twoSoln(): calculates and prints the two real solutions def oneSoln() : calculates and prints the one real solution def noSoln(): informs the user that there is no real solutions. The following are sample runs of the program. O o o Sample run 1: Sample run 2: Sample run 3: Enter the coefficients a, b, and c: Enter the coefficients a,b, and c: Enter the coefficients ab, and c: 1 1 1 5 -6 1 6 9 Your equation has no real solution. There are two real solution: x = -2.00 or x = -3.00 There is ONE real solution, x = 3.0 Note 1. Reading from the user must be in the main function only. 2. Assume the user enters valid inputs; no need to validate user input
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
