Question 1: Quadratic Equation Solver

Write a Python program which accepts the three coefficients of a quadratic equation (a, b, c) and computes the solution.

A quadratic equation is of the form:

U2-L2-01A.png

And the solution can be found using the following formula:

U2-L2-01B.png

Function Input Argument(s):

There will be 3 inputs

  1. a (integer)

  2. b (integer)

  3. c (integer)

Function Return Value:

The program should print a output according to the table below.

Math Solution Return
No real roots 'No real roots'
Exactly 1 real root value of the real root, rounded to 2 decimal points as a string
2 real roots both roots in the format of "[root1], [root2]" as a string. First root1 must be smaller than root2 and both roots should be rounded to 2 decimal points

Example 1

Function Input Argument(s):

(1, 2, 1)

Function Return Value:

"-1.00”