Python Object-Oriented Python Inheritance Super!

william coleman
william coleman
3,083 Points

Can't figure out why my code won't pass the "Super!" code challenge. It functions properly outside of the challenge.

Can't figure out why my code won't pass the "Super!" code challenge. It functions properly outside of the challenge. The only feedback I get is "bummer: try again".

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

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 138,264 Points

Hi William,

Your code looks fine.

There may have been a temporary glitch in the with the code checker in the Challenge. I copy/pasted your code above into a fresh challenge and all 3 tasks did pass. So, if your still stuck, restart the challenge and just paste in your code from above and it should all be fine.

Nice work!! :) :dizzy: