Basta Fazoolin, Error: 'str' object has no attribute 'start_time'

I have problem with 18 exrecise from Basta Fazoolin project. When I trying to check available menus, I got error:

Traceback (most recent call last):
  File "", line 59, in <module>
  File "", line 13, in available_menus
    if time >= menu.start_time and time <= menu.end_time:
AttributeError: 'str' object has no attribute 'start_time'

I can’t understand what’s wrong.
My code:

import datetime
class Franchise:
  def __init__(self, address, menus):
    self.address = address
    self.menus = menus
  def __repr__(self):
    return "Addres: {0}".format(self.address)
  def available_menus(self, time):
    av_menu = []
    for menu in self.menus:
      if time >= menu.start_time and time <= menu.end_time:
    return av_menu
class Menu:
  def __init__(self, name, items, start_time, end_time): = name
    self.items = items
    self.start_time = start_time
    self.end_time = end_time
  def __repr__(self):
    return + " available from " + self.start_time + " to " + self.end_time
  #def __repr__(self):
  #  return "Name: {0}, Time: {1} - {2}".format(,(self.start_time), (self.end_time)) 
  def calculate_bill(self, purchase_items):
    total = 0
    for x in purchase_items:
      total += self.items[x]
    return total
flagship_store = Franchise("1232 West End Road", ["brunch","early_bird","dinner","kids"])    
new_installment = Franchise("12 East Mulberry Street", ["brunch","early_bird","dinner","kids"])

brunch = Menu("brunch",{
  'pancakes': 7.50, 'waffles': 9.00, 'burger': 11.00, 'home fries': 4.50, 'coffee': 1.50, 'espresso': 3.00, 'tea': 1.00, 'mimosa': 10.50, 'orange juice': 3.50
}, datetime.time(11,0),datetime.time(16,0))

early_bird = Menu("early_bird",{
  'salumeria plate': 8.00, 'salad and breadsticks (serves 2, no refills)': 14.00, 'pizza with quattro formaggi': 9.00, 'duck ragu': 17.50, 'mushroom ravioli (vegan)': 13.50, 'coffee': 1.50, 'espresso': 3.00,
}, datetime.time(15,0),datetime.time(18,0))

dinner = Menu("dinner",{
  'crostini with eggplant caponata': 13.00, 'ceaser salad': 16.00, 'pizza with quattro formaggi': 11.00, 'duck ragu': 19.50, 'mushroom ravioli (vegan)': 13.50, 'coffee': 2.00, 'espresso': 3.00,
}, datetime.time(17,0),datetime.time(23,0))

kids = Menu("kids",{
  'chicken nuggets': 6.50, 'fusilli with wild mushrooms': 12.00, 'apple juice': 3.00
}, datetime.time(11,0),datetime.time(21,0))

print(brunch.calculate_bill(["pancakes","home fries","coffee"]))
print(early_bird.calculate_bill(['salumeria plate',"mushroom ravioli (vegan)"]))


Hi @feodanciy

Python is telling you what the error is.

  File "", line 13, in available_menus
    if time >= menu.start_time and time <= menu.end_time:
AttributeError: 'str' object has no attribute 'start_time'

The value of flagship_store.menus is ["brunch","early_bird","dinner","kids"].

What type is each of the objects in that list? They’re strings.

Do you see why you can’t get the value of the attribute start_time from those objects? Strings have no start_time attribute. I suspect you’re supposed to pass in instances of your Menu class.

Hope that helps.