[Tutor] Trouble with exercise regarding classes
alan.gauld at btinternet.com
Thu Aug 26 01:24:40 CEST 2010
"Andrew Martin" <amartin7211 at gmail.com> wrote
> However, when I did so I got this error: "TypeError: unbound method
> must be called with Projectile instance as first argument (got
> instead) "
>> def main():
>> angle, vel, h0, time = getInputs()
>> cball = Projectile(angle, vel, h0)
cball is a Projectile instance
>> zenith = 0.0
>> while cball.getY() >= 0:
So this is fine
>> if Projectile.getY > zenith:
>> zenith = Projectile.getY()
But what are you doing here?
You are trying to compare the getY method of the class with a floating
Then you call getY using the class rather than the instance?
I'm confused - and so is Python...
Author of the Learn to Program web site
More information about the Tutor