Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Object-Oriented Python (retired) Inheritance Subclass

Traci Armstrong
Traci Armstrong
1,447 Points

Object oriented programming challenge task 1 of 1

It just says bummer try again....

my_monster.py
from monster import Monster

class Dragon(Monster):

  def __init__(self, size):
    size = 3

3 Answers

Try:

from monster import Monster

class Dragon(Monster): size = 3

I dont think you need the def init(self, size): because its inherited those attributes from Monster. If you create a new def _init(self), I think that overrides the Monster one.

Jeremy Fisk
Jeremy Fisk
7,768 Points

For this particular challenge, you do not need to use the __init__ method, the instructor simply wants you to assign the Dragon subclass the attribute of size directly following the Class declaration

Matthew Rigdon
Matthew Rigdon
8,223 Points

Jeremy had it. This question does not require that you use the init method. We use init when we want a class to automatically begin and do some process. However, in this case, all we need is for this class to assign the dragon's size. That is accomplished by a simple size = 3. Everything else you had typed was perfect.