Skip to content

Puzanira/7_mistery_fix

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 

Repository files navigation

Quadratic Equation Solver

If you have an equation of the form ax^2 + bx + c = 0, I can solve it for you.

How to use:

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

How to launch:

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

Project Goals

For educational purposes only. DEVMAN.org

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%