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
Nat Rogers
7,433 PointsDoesn't recognize class method
Treehouse is saying there is no method called 'roll' in the hands file....but there is, so I'm confused.
from dice import D20
class Hand(list):
def __init__(self, size = 0):
super().__init()
for _ in range(size):
self.append(D20())
@property
def total(self):
return sum(self)
@classmethod
def roll(cls, num_dice):
hand = Hand(num_dice)
return hand
[MOD: added ```python formatting -cf]
1 Answer
Chris Freeman
Treehouse Moderator 68,468 PointsYou are so very close. When a method is not found it can sometimes mean there is a typo or syntax error in the code preventing the method or class to compile correctly.
In this case, you are missing a trailing double-underscore in the body of the __init__ method's super call.
Post back if you need more help. Good luck!!!