<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> bob gailer &lt;bgailer@gmail.com&gt;<br><b><span style="font-weight: bold;">To:</span></b> tutor@python.org<br><b><span style="font-weight: bold;">Sent:</span></b> Sun, April 25, 2010 12:52:10 PM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [Tutor] sqrt?<br></font><br>
On 4/24/2010 11:00 PM, Kirk Z Bailey wrote:<br>&gt; ok gang, My desktop runs 2.5, and for my college algebra I needed to do som quadratic equation work. This involves squareroots. So I fired uop the interactive idle and imported math. I then tried to play with sqrt.<br>&gt; <br>&gt; Nothing.<br><br>As Hugo pointed out - asking good questions is important. That includes being really specific. "play" and "nothing" are not specific. We can guess - we might even be right - but that is costly for all of us in time.<br><br>Python rarely gives "nothing".<br><br>You usually get some result (perhaps you don't agree with it) or some error (traceback). Sometimes there is no visible result, as the case with import.<br><br>So if I were willing to spend some time guessing I'd guess that you did and got something like:<br><br>&gt;&gt;&gt; import math<br>&gt;&gt;&gt; sqrt<br>Traceback (most recent call last):<br>&nbsp; File "&lt;stdin&gt;", line 1, in
 &lt;module&gt;<br>NameError: name 'sqrt' is not defined<br>&gt;&gt;&gt;<br><br>Please either confirm or alter the above. IOW show us what you entered and what you got.<br><br>Did you read the Python Manual's explanation of import?<br><br>&gt; <br>&gt; Importing math does not import a sqrt function.<br><br>Not under that name, as a global variable. It did create a global name math. Math has attributes, one of which is sqrt.<br><br>&gt; <br>&gt; Now riddle me this: if string.foo makes it do a function FOO on a string<br><br>Wow - so many assumptions, errors and generalities. Where would I even begin?<br><br>&gt; , whyfore and howcome does math.sqrt not do square roots on a simple number like 4???<br><br>O but it does, as others have pointed out<br>&gt;&gt;&gt; math.sqrt(4)<br>2.0<br><br>&gt; <br>&gt; I am now officiciously pissed.<br>&gt; <br>&gt; Help?<br>&gt; <br><br>I am a newbie but after typing "import math"<br>you can do a dir(math) to get the
 available first level methods available to you.<br>&gt;&gt;&gt; import math<br>&gt;&gt;&gt; dir(math)<br>['__doc__', '__file__', '__name__', '__package__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'copysign', 'cos', 'cosh', 'degrees', 'e', 'exp', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'hypot', 'isinf', 'isnan', 'ldexp', 'log', 'log10', 'log1p', 'modf', 'pi', 'pow', 'radians', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc']<br><br><br>Eric<br><br>_______________________________________________<br>Tutor maillist&nbsp; -&nbsp; <a ymailto="mailto:Tutor@python.org" href="mailto:Tutor@python.org">Tutor@python.org</a><br>To unsubscribe or change subscription options:<br><span><a target="_blank" href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor</a></span><br></div></div>
</div><br>

      </body></html>