Basta Fazoolin'

Traceback (most recent call last):
File “script.py”, line 65, in
print(flagship_store.available_menus(1600))
File “script.py”, line 12, in available_menus
if menu.start_time <= time <= menu.end_time:
AttributeError: ‘dict’ object has no attribute ‘start_time’

I don’t know what’s wrong ,help me thx

Something that strikes me as an issue is this assignment…

self.menus = menus

I only bring this up because there is a Menu class and one would expect self.menus to be a collection of that type of object.

What this means is the parameter is not needed, only the initial value, an empty list. That would take the place of available menus in terms of creation.

def add_menu(self, menu):
    if isinstance(menu, Menu):
        self.menus.append(menu)

Treat the above as pseudo-code until it is tested.

The reasoning here is that if all the menus are Menu class instances, then they all have the same inherited methods, AND, they inherit the parent class methods as well.

    if Menu.start_time <= time <= Menu.end_time:

would be written on the instance, not the class…

    if menu.start_time <= time <= menu.end_time:
5 Likes

Hi @tony0z,

Your code includes the following lines:

menus= [brunch_items, early_bird_items, dinner_items, kids_items]

flagship_store = Franchise("1232 West End Road", menus)
new_installment = Franchise("12 East Mulberry Street", menus)

The first among those lines assigns to menus a list of dicts rather than a list of Menu instances.

Based on the project instructions, when we instantiate a Franchise, we are expected to pass a list of Menu instances as the second argument. Within your code, examples of such instances are brunch, early_bird, dinner, and kids.

EDITED on September 17, 2019 to provide the following link to the project page:

Basta Fazoolin’

4 Likes

thx you guys i now why…:slight_smile:

2 Likes