Python Object-Oriented Python Inheritance Super!

Lucas Wijk
Lucas Wijk
6,369 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()
Lucas Wijk
Lucas Wijk
6,369 Points

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

1 Answer

Steven Parker
Steven Parker
180,224 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.