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

 Excercise #3 Write a python code that solve quadratic equation ax

Excercise #3 Write a python code that solve quadratic equation ax + bx + c = 0. The quadratic equation can have either one of two distinct real solutions, or has no real solution . Based on the value of the discriminant b2 - 4ac of the quadratic equation there are three cases . If this discriminant is positive, then there are two distinct solutions -b+va -1-va 20 20 Wheredis is discriminant of the quadratic equation . If the discriminant is zero then there is exactly one real solution and- . If the discriminant is negative then the equation has no real solution You should provide the following functions . det main(): function that do the following: Prompts the user to enter the a, bande Then, calls the solvequadratic() function to solve the quadratic equation . def selveQuadratica,b,c): This function calculates the discriminant - 4ac and using its value to call one of the following funtions: de twoselno): calculates and prints the vo real solutions def oneSoin): calculates and prints the one real solution det nosoin(): informs the user that there is no real solutions The following are sample runs of the program Sample run 1: Sample run 2 Sample runs Enter resoerente ao and Enter me species a., and Enter the coeficients 3.0, and 5 Your euation has no real solution. There are two real solution: 2--200 or xe 300 there is ONE real solution - 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

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!