# [Tutor] ask-why I cannot run it, and I am so confused about the traceback

Shurui Liu (Aaron Liu) shurui91 at gmail.com
Wed Apr 7 14:12:37 CEST 2010

```Yes, I found it. thanks!

On Wed, Apr 7, 2010 at 7:00 AM, Wesley Brooks <wesbrooks at gmail.com> wrote:

> Morning,
>
> Your only supplying one argument to cone, when you need two: radius &
> height.
>
> Cheers,
>
> Wesley Brooks.
>
> On 7 April 2010 11:56, Shurui Liu (Aaron Liu) <shurui91 at gmail.com> wrote:
> > # Filename: classVolume.py
> > # Demonstrates multiple classes per program.
> >
> > class Cube:
> >    """A class for cube shapes."""
> >    def __init__(self, side):
> >        self.side = side
> >    def calculateArea(self):
> >        return (self.side)**3.0
> >
> > class Sphere:
> >    """A class for sphere shapes."""
> >    def calculateArea(self):
> >        import math
> >
> > class Cone:
> >    """A class for cone shapes."""
> >    def __init__(self, radius2, height):
> >        self.height = height
> >    def calculateArea(self):
> >        import math
> >
> >
> > # Create a list of volumes.
> > list = [Cube(1.1),Cube(1.2),Sphere(1.1),Sphere(1.2),Cone(1.1),Cone(1.2)]
> >
> > # Print out the list contents.
> > for volume in list:
> >    print "The volume is: ", volume.calculateArea()
> > raw_input("\n\nPress the enter key to exit.")
> >
> >
> >
> >
> >
> > Traceback (most recent call last):
> >  File "classVolume.py", line 30, in <module>
> >    list =
> [Cube(1.1),Cube(1.2),Sphere(1.1),Sphere(1.2),Cone(1.1),Cone(1.2)]
> > TypeError: __init__() takes exactly 3 arguments (2 given)
> >
> >
> > --
> > Shurui Liu (Aaron Liu)
> > Computer Science & Engineering Technology
> > University of Toledo
> > 419-508-1228
> >
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor at python.org
> > To unsubscribe or change subscription options:
> > http://mail.python.org/mailman/listinfo/tutor
> >
> >
>

--
Shurui Liu (Aaron Liu)
Computer Science & Engineering Technology
University of Toledo
419-508-1228
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100407/19bb1ec5/attachment-0001.html>
```