If you have an equation of the form ax^2 + bx + c = 0, I can solve it for you.
In a file there is a function
get_roots(a, b, c)
Input: It takes 3 numbers - coefficiens a, b, c from the formula
ax^2 + bx + c = 0
Output: Discriminant = b^2 − 4ac
- two roots: (x1, x2) - if discriminant > 0
- one root, None: (x1, None) - if discriminant == 0
- None, None: (None, None) - if discriminant < 0
You need pre-installed Python 3.5 of higher
Usage Example:
#import the function
from quadratic_equation import get_roots
a, b, c = map(int, input().split())
x1, x2 = get_roots(a, b, c)
print(x1, x2)
Unit Testing:
Testing with Python's unittest
module.
unittest
- Automated testing framework
Example of script launch on Linux, Python 3.5::
python tests.py
For educational purposes only. DEVMAN.org