Python Object-Oriented Python Inheritance Super!

Albert Egberg
Albert Egberg
7,783 Points

Can someone spot what I am doing wrong here?

What am I missing?

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

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

class SortedInventory(Inventory):
    def add_item(self, item):
        super().add_item(item)
        self.slots.list()
Albert Egberg
Albert Egberg
7,783 Points

It should be sort ( ) and not list ( ). Two different functions.

1 Answer

Steven Parker
Steven Parker
200,760 Points

The instructions ask you to use the ".sort()" method of a list to make sure the slots list gets sorted after an item is added. Lists don't have a ".list()" method in any case.