Using "import math".
Chris Warrick
kwpolska at gmail.com
Sun Jun 7 02:12:48 EDT 2015
On 7 Jun 2015 00:06, "Steve Burrus" <steveburrus28 at gmail.com> wrote:
>
> I need some help/assistance with using the python "import math" function.
Like I am trying to do a = math.sqrt(1000)
> a.sqrt
> but it fails. what am I doing wrong? Thanx for anyone's help.
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
Here's what your code did:
import math # make the math module accessible
a = math.sqrt(1000) # set `a` to the square root of 1000 (≈31.62...)
a.sqrt # get a reference to the sqrt method/attribute of a float, which
does not exist; moreover you are not calling the method/discarding the
value so it would be useless anyways
--
Chris Warrick <https://chriswarrick.com>
Sent from my Galaxy S3.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150607/b0247b69/attachment.html>
More information about the Python-list
mailing list