I have started this program but failed several times and I really appreciate some help please. Thanks

What have you done with this assignment, so far? We cannot give you code or you risk your teacher giving a Fail, or worse, a zero, but we can give suggestions to help you find your way.

Before complicating matters, start with the simplest code that has no conditionals in it and get the correct output for the first set of inputs (two real roots). That should take just enough code to complete both computations for x. Keep it simple and declare the coefficient values as literals, for now (no input()). You’ll probably want to import sqrt rather than use `n ** 0.5`

```
from math import sqrt
a = 1
b = -1
c = -2
# rest of code inline
```

Test output from an inline test version…

```
# quadratic_formula.py
a = 1, b = -1, c = -2 | There are two real roots, x = -1.0 and 2.0
>>>
a = 0, b = -1, c = -2 | The equation is linear. x = -2.0
>>>
a = 0, b = 0, c = -2 | There is no solution.
>>>
a = 0, b = 0, c = 0 | Solution is indeterminate!
>>>
a = 2, b = 4, c = 2 | Roots are loaded. x = -1.0
>>>
a = 5, b = 2, c = 1 | There is no real solution.
>>>
```

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.