I keep on having problems with syntax and calculating the roots of the quadratic equation
<p>Hey I am having problems with calculating the roots of the quadratic equation with the quadratic formula, using python's complex number functionality.</p>

<p>When I try</p>

<pre><code>&gt;&gt;&gt; if root&lt;0:
        root=abs(complex(root))
        j=complex(0,1)
        x1=(-b+sqrt(root))/2*a
        x2=(-b-j+sqrt(root))/2*a
        else:
</code></pre>

<p>I get the error message</p>

<blockquote>
  <p>SyntaxError: invalid syntax</p>
</blockquote>

<p>Then, when I try instead</p>

<pre><code>&gt;&gt;&gt; if root&lt;0:
        root=abs(complex(root))
        j=complex(0,1)
        x1=(-b+j+sqrt(root))/2*a
        x2=(-b-j+sqrt(root))/2*a
        break
</code></pre>

<p>I get the error</p>

<blockquote>
  <p>SyntaxError: 'break' outside loop</p>
</blockquote>

<p>I am trying to put:</p>

<pre><code>else:
    x1=(-b+j+sqrt(root))/2*a
    x2=(-b-j+sqrt(root))/2*a
</code></pre>

<p>under it but it won't work.</p>

<p>Any help please?</p>
