Error at my python code
<p>when i run this code :</p>

<pre><code>import math
print "welcome !This program will solve your quadratic equation"

A = input("inter a =")
B = input("inter b =")
C = input("inter c =")
J=math.pow(B,2)-4*A*C 
X1=-B+math.sqrt(J)/2*A
X2=-B-(math.sqrt(J))/(2*A)
print "your roots is :" , X1 , X2
</code></pre>

<hr>

<p>it gives me error ?! why 
thank you ^</p>

<p>Without any information about which kind of error your program raises, I think that the problem is linked to the function <strong>math.sqrt</strong> which doesn't find complex roots.</p>

<p>So I suggest you to use <strong>cmath</strong> in this way:</p>

<pre><code>import cmath, math
print "welcome !This program will solve your quadratic equation"

A = input("inter a =")
B = input("inter b =")
C = input("inter c =")
J=math.pow(B,2)-4*A*C 
X1=-B+cmath.sqrt(J)/2*A
X2=-B-(cmath.sqrt(J))/(2*A)
print "your roots is :" , X1 , X2
</code></pre>

<p>Furthermore, I suggest you to implement some checks on the input, because user could insert a <strong>string</strong> or a <strong>null</strong> value (as @Ted Klein Bergman suggests).</p>

<p>If this doesn't solve your problem, please edit your question and add more  details about your error.</p>

python pycharm