Python Forum

Full Version: using class
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I mean the modified code. I didn't understand the some of english terms.
My idea was to change Rocket to this:

class Rocket ():
    def __init__(self, name, height):
        self.name = name
        self.height = height
So now you have to specify the height each time you make a rocket. In your loop when you create the rocket, you just need to increase that amount by 10 each time through the loop.
Pages: 1 2