[Tutor] calculate area of a circle

vishwajeet singh dextrous85 at gmail.com
Wed Apr 15 10:59:16 CEST 2009


you need import math

On Wed, Apr 15, 2009 at 2:22 PM, mbikinyi brat <mbikinyi_brat at yahoo.com>wrote:

> Hi All,
> This is a code I have written to calculate the area of a circle.
> *def area(radius):
>  temp=math.pi*radius**2
>  return temp*
> **
> *I* now call it by entering *area(12)* at the prompt in IDLE. This is the
> error message I get. Can someone help please?
> *Traceback (most recent call last):
>   File "<pyshell#22>", line 1, in <module>
>     area(10)
>   File "<pyshell#21>", line 2, in area
>     temp=math.pi*radius**2
> NameError: global name 'math' is not defined*
> **
> Regards,
> Henry
>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>


-- 
Cheers,
Vishwajeet
http://www.singhvishwajeet.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090415/15d176cf/attachment.htm>


More information about the Tutor mailing list