<div class="gmail_quote">On Sun, Apr 18, 2010 at 10:21 AM, Aidas <span dir="ltr">&lt;<a href="mailto:aidas@vineva.lt">aidas@vineva.lt</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Hello.<br>
In here <a href="http://mail.python.org/pipermail/tutor/2001-February/003385.html" target="_blank">http://mail.python.org/pipermail/tutor/2001-February/003385.html</a> You had written how to ger root in python. The way is: &quot;from math import sqrtprint sqrt( 49 )&quot;.<br>


<br>
I noticed that if I write just &quot;print sqrt(49)&quot; I get nothing. So why I need to write &quot;from math import sqrt&quot; instead of write just &quot;print sqrt( 49 )&quot;?<br>
<br>
P.S. Sorry about english-I&#39;m lithuanian. :)<br>
<br></blockquote><div><br></div><div><div>&gt;&gt;&gt; sqrt()</div><div>Traceback (most recent call last):</div><div>  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;</div><div>NameError: name &#39;sqrt&#39; is not defined</div>

</div><div><br></div><div>That traceback tells you what the error is and where the error is. The NameError is the specific type of error, and it tells you why - sqrt is not defined.</div><div><br></div><div>In order to call a function its name needs to be defined. When you type &#39;&gt;&gt;&gt; from math import sqrt&#39; then you are importing the function (or name) sqrt from the math module.</div>

<div><br></div><div>Then you can use it:</div><div><div>&gt;&gt;&gt; from math import sqrt</div><div>&gt;&gt;&gt; print sqrt(49)</div><div>7.0</div></div><div><br></div><div><br></div><div>HTH,</div><div>Wayne</div><div>
<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
_______________________________________________<br>
Tutor maillist  -  <a href="mailto:Tutor@python.org" target="_blank">Tutor@python.org</a><br>
To unsubscribe or change subscription options:<br>
<a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/mailman/listinfo/tutor</a><br>
</blockquote></div><br>