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:
And the solution can be found using the following formula:
There will be 3 inputs
a (integer)
b (integer)
c (integer)
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 |
Function Input Argument(s):
(1, 2, 1)
Function Return Value:
"-1.00”