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

Devin Scheu
Devin Scheu
66,191 Points

Help With Python Sub-Classes

Question: Create a new class named Dragon that extends the Monster class. Don't forget to import Monster from monster. Give your Dragon a size attribute.

My code:

my_monster.py
from monster import Monster

class Dragon(Monster):
  size = []
  pass

1 Answer

Charlie Thomas
Charlie Thomas
40,856 Points

Remove your pass statement and change your size to be an integer.

from monster import Monster

class Dragon(Monster):
  size = 1