Loading...
Loading...
Loading...
A quadratic equation a x² + b x + c = 0 has two real roots when b² − 4ac is above 0, one real root when it is exactly 0 and no real roots when it is below 0. If a is 0, the equation is not quadratic.
Given integers a, b and c, print Not quadratic when a is 0. Otherwise print Two real roots, One real root or No real roots.
Not quadratic, Two real roots, One real root, No real roots.Example 1
Input
1 -3 2
Output
Two real roots
Example 2
Input
1 2 5
Output
No real roots
Try the problem first. Open one hint at a time.
Calculate the discriminant b * b - 4 * a * c once and keep it in a variable.
Test a == 0 first, because a quadratic with a = 0 has no discriminant meaning. Then compare the discriminant with 0.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor