- import math
- def quadratic_equation(a, b, c):
- t = math.sqrt(pow(b, 2) - 4 * a * c)
- if(pow(b, 2) - 4 * a * c) > 0:
- return (-b + t) / (2 * a), (-b - t) / (2 * a)
- elif (pow(b, 2) - 4 * a * c) == 0:
- return (-b + t) / (2 * a)
- else:
- return None
- print quadratic_equation(2, 3, 0)
- print quadratic_equation(1, -6, 5)