Python Object-Oriented Python Dice Roller RPG Roller

Hand.py Bummer: Didn't get `D20`s in my `Hand` instance

I have run my code in the workspace with success. Can I get some help understanding the error with 'D20'?

dice.py
import random


class Die:
    def __init__(self, sides=2):
        if sides < 2:
            raise ValueError("Can't have fewer than two sides")
        self.sides = sides
        self.value = random.randint(1, sides)

    def __int__(self):
        return self.value

    def __add__(self, other):
        return int(self) + other

    def __radd__(self, other):
        return self + other

class D20(Die):
    def __init__(self, sides=20):
        super().__init__(sides)
hands.py
from dice import D20

class Hand(list):

    @property
    def total(self):
        return sum(self)

    @classmethod
    def roll(cls, num_dice):
        dice_roll = []

        for n in range(num_dice):
            num = int(D20())
            dice_roll.append(num)
        return cls(dice_roll)

1 Answer