Python Object-Oriented Python Inheritance Super!

Alexandru Patriche
Alexandru Patriche
8,790 Points

Why is my code not being accepted as correct, what am I missing?

Hi guys,

I have played with slightly different answers and nothing worked. The challenge simply asks to create the subclass and then "pass" it.

I have done so but it is not working. What am I missing?

inventory.py
class Inventory:
    def __init__(self):
        self.slots = []

    def add_item(self, item):
        self.slots.append(item)

def SortedInventory(Inventory):
    pass

1 Answer

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 47,362 Points

You created a function not a class. Instead of this:

def SortedInventory(Inventory):
    pass

try this:

class SortedInventory(Inventory):
    pass
Alexandru Patriche
Alexandru Patriche
8,790 Points

thank you, can't believe I missed that :D