Why am I getting this Error message

Ray Holt mrholtsr at sbcglobal.net
Thu Jan 28 20:57:05 CET 2010


Why am I getting the following error message. Area has been declared as an
attribute of Circle. Thanks, Ray
 
class Circle:
 def __init__(self):
     self.radius = 1
 def area(self):
     return self.radius * self.radius * 3.14159
 c = Circle()
 c.radius = 3
 print c.area()

 

Traceback (most recent call last):
  File "<pyshell#9>", line 1, in <module>
    class Circle:
  File "<pyshell#9>", line 8, in Circle
    print c.area()
AttributeError: Circle instance has no attribute 'area'

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100128/4bbf09d7/attachment.html>


More information about the Python-list mailing list