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 trialDavid Bell
16,997 PointsIs there more to the subclass challenge that I'm not understanding?
I feel like my answer addresses the challenge, but I'm not certain what I'm actually missing, based on the question. My code is attached.
The error I get is a TypeError, stating that init only takes 2 values, and I'm trying to pass 3, which I don't see that I'm doing. Do I, unlike the video example, need to set an init for Dragon? What am I missing?
import monster
class Dragon(monster):
size = 10
1 Answer
David Bell
16,997 PointsGurgle. Learning moment:
The import syntax is exactly wrong. Should be:
from monster import Monster
not the other way around. Not like the random import, different because its a user generated file, it seems.
Nothing to see here. :)
Kenneth Love
Treehouse Guest TeacherKenneth Love
Treehouse Guest TeacherIt's not the creation of the file (user vs built-in) that matters, but what we want from the file. Before, we asked for the entire
random
library. Now, though, we only want a single class,Monster
, from ourmonster
library. This is just like doingfrom random import randint
.David Bell
16,997 PointsDavid Bell
16,997 PointsI see! Thank you!