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 trialliamthornback2
9,618 PointsTypeError
When I try to create an instance of the Hand class in the python shell I get the following error message:
>>> import dice, hands
>>> hand = hands.Hand(size=5, die_class=dice.D6)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: list() takes at most 1 argument (2 given)
Here is my code (as far as I can see it matches the code in the lesson):
class Hand(list):
def __int__(self, size, die_class=None, *args, **kwargs):
if not die_class:
raise ValueError("You must provide a die class")
super().__init__()
for num in range(size):
self.append(die_class())
1 Answer
KRIS NIKOLAISEN
54,972 PointsYou have int instead of init here:
def __int__(self, size, die_class=None, *args, **kwargs):
should be
def __init__(self, size, die_class=None, *args, **kwargs):
liamthornback2
9,618 Pointsliamthornback2
9,618 PointsThanks