Python Object-Oriented Python Inheritance Super!

Simla Sophia Yildirim
Simla Sophia Yildirim
12,728 Points

Sorting inventories (3/3)

I really don't get what is wrong with my code. It seems right to me, but not working :(

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

Jennifer Nordell
MOD
Jennifer Nordell
Treehouse Moderator

Hi there, Simla Sophia Yildirim ! From what I can tell, there's nothing wrong with your code at all. In fact, when I copy/paste it into the challenge, it passes all steps. This leads me to believe that there might be a caching problem either client-side or server-side. I might suggest copying this code, and completely restarting the challenge then pasting it in. If that doesn't work, you might consider logging out of Treehouse, shutting down your browser, logging in again and then pasting in the code.

But this code should work! :sparkles: