I just starting programming and am trying to learn some python (ver 2.6). I am reading Python Programming: An Introduction to Computer Science by John Zelle. In chapter ten, the first programming exercise asks the reader to modify code from the chapter (below) . The code I added is highlighted. However, when I did so I got this error: &quot;TypeError: unbound method getY() must be called with Projectile instance as first argument (got nothing instead) &quot; Can someone help me out with what I am doing wrong? Please be as straitforward as you can. I am still struggling with classes<br>
<br>Thanks a lot<br><br><br><blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote"># cball4.py<br>#   Simulation of the flight of a cannon ball (or other projectile)<br>
#   This version uses a  separate projectile module file<br><br>from projectile import Projectile<br><br>def getInputs():<br>    a = input(&quot;Enter the launch angle (in degrees): &quot;)<br>    v = input(&quot;Enter the initial velocity (in meters/sec): &quot;)<br>
    h = input(&quot;Enter the initial height (in meters): &quot;)<br>    t = input(&quot;Enter the time interval between position calculations: &quot;)<br>    return a,v,h,t<br><br>def main():<br>    angle, vel, h0, time = getInputs()<br>
    cball = Projectile(angle, vel, h0)<br>    zenith = 0.0<br>    while cball.getY() &gt;= 0:<br>        cball.update(time)<br>        <span style="background-color: rgb(255, 255, 51);">if Projectile.getY &gt; zenith:</span><br style="background-color: rgb(255, 255, 51);">
<span style="background-color: rgb(255, 255, 51);">            zenith = Projectile.getY()</span><br>    print &quot;\nDistance traveled: %0.1f meters.&quot; % (cball.getX())<br>    <span style="background-color: rgb(255, 255, 51);">print &quot;The heighest the cannon ball reached was %0.1f meters.&quot; % (zenith)</span><br>
<br>if __name__ == &quot;__main__&quot;: main()<br><br><br></blockquote><div><br><br><blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote"># projectile.py<br>
<br>&quot;&quot;&quot;projectile.py<br>Provides a simple class for modeling the flight of projectiles.&quot;&quot;&quot;<br>   <br>from math import pi, sin, cos<br><br>class Projectile:<br><br>    &quot;&quot;&quot;Simulates the flight of simple projectiles near the earth&#39;s<br>
    surface, ignoring wind resistance. Tracking is done in two<br>    dimensions, height (y) and distance (x).&quot;&quot;&quot;<br><br>    def __init__(self, angle, velocity, height):<br>        &quot;&quot;&quot;Create a projectile with given launch angle, initial<br>
        velocity and height.&quot;&quot;&quot;<br>        self.xpos = 0.0<br>        self.ypos = height<br>        theta = pi * angle / 180.0<br>        self.xvel = velocity * cos(theta)<br>        self.yvel = velocity * sin(theta)<br>
<br>    def update(self, time):<br>        &quot;&quot;&quot;Update the state of this projectile to move it time seconds<br>        farther into its flight&quot;&quot;&quot;<br>        self.xpos = self.xpos + time * self.xvel<br>
        yvel1 = self.yvel - 9.8 * time<br>        self.ypos = self.ypos + time * (self.yvel + yvel1) / 2.0<br>        self.yvel = yvel1<br><br>    def getY(self):<br>        &quot;Returns the y position (height) of this projectile.&quot;<br>
        return self.ypos<br><br>    def getX(self):<br>        &quot;Returns the x position (distance) of this projectile.&quot;<br>        return self.xpos<br></blockquote></div><br><input id="gwProxy" type="hidden"><input onclick="jsCall();" id="jsProxy" type="hidden"><div id="refHTML">
</div>