Grokbase Groups Python tutor May 2011
FAQ
How do I can access to the math module to use PI?

area = math.pi * pow(3,2)
Traceback (most recent call last):
File "<pyshell#16>", line 1, in <module>
area = math.i * pow(3,2)
NameError: name 'math' is not defined

--
Dave Merrick

merrickdav at gmail.com

Ph 03 3423 121
Cell 027 3089 169
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110526/480c86ca/attachment.html>

Search Discussions

  • Memilanuk at May 26, 2011 at 4:36 am

    On 05/25/2011 09:21 PM, David Merrick wrote:
    How do I can access to the math module to use PI?

    area = math.pi * pow(3,2)
    Traceback (most recent call last):
    File "<pyshell#16>", line 1, in <module>
    area = math.i * pow(3,2)
    NameError: name 'math' is not defined
    try 'import math' first...
  • Delegbede at May 26, 2011 at 9:35 am
    Do import math first I.e type
    import math
    You could also do
    from math import pi
    Provided pi is the only function u need in the math module.
    from math import *
    This imports every function of the math module.
    HTH
    Sent from my BlackBerry wireless device from MTN

    -----Original Message-----
    From: David Merrick <merrickdav at gmail.com>
    Sender: tutor-bounces+delegbede=dudupay.com at python.org
    Date: Thu, 26 May 2011 16:21:01
    To: <Tutor at python.org>
    Subject: [Tutor] PI

    _______________________________________________
    Tutor maillist - Tutor at python.org
    To unsubscribe or change subscription options:
    http://mail.python.org/mailman/listinfo/tutor

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouptutor @
categoriespython
postedMay 26, '11 at 4:21a
activeMay 26, '11 at 9:35a
posts3
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase