Why do I get math domain error?
Why do I get this error? I'm trying to solve an equation like this: ax^2 + bx + c Traceback (most recent call last): File "I:/Taller de Programacion I/Clase 5/11.py", line 6, in <module> x1 = (-b + sqrt(b ** 2 - a * c)) / (2 * a) ValueError: math domain error The math module (which I suppose you are using) doesn't support complex numbers. Either use cmath (python2 and python3) or the power operator ** (python3). This should always work, no matter the sign of the discriminant: x1 = (-b + (b ** 2 - 4 * a * c) ** .5) / 2 / a Example: >>> b = 1 >>> a = 2 >>> c = 3 >>> (-b + (b ** 2 - 4 * a * c) **