Python Object-Oriented Python Inheritance Super!

Akshaan Mazumdar
Akshaan Mazumdar
2,356 Points

How to sort slots

unable to pass challenge . How will it work??

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.sort()

1 Answer

Steven Parker
Steven Parker
168,395 Points

You're really close! You just have an indentation error.

That last line (with "sort") should be indented further so it will be considered part of the "add_item" method.