Basta Fazoozlin project

Hi so I am on step 11 of the Basta Fazoozlin python project [https://www.codecademy.com/courses/learn-python-3/projects/basta-fazoolin] and I am stuck.
I have all the right information but the calculate_bill function is not working properly. according to the instructions, the total bill for the early bird meal should be 21.5 yet I keep getting 8.0. I have provided my code below. any information would help, I even looked at the video walkthrough and I am still stumped.

class Menu:
  def __init__(self, name, items, start_time, end_time):
   self.name = name  
   self.items = items
   self.start_time = start_time
   self.end_time = end_time

  def __repr__(self):
    return self.name + ' menu available from ' + str(self.start_time) + ' - ' + str(self.end_time)
  
  def calculate_bill(self, purchased_items):
    bill = 0
    for purchased_item in purchased_items:
      if purchased_item in self.items:
        bill += self.items[purchased_item]
    return bill

brunch_items = {
  '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
}
brunch_menu = Menu('Brunch', brunch_items, 1100, 1600)

early_bird_items = {
   '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,
}
early_bird_menu = Menu('Early_Bird', early_bird_items, 1500, 1800)

print(early_bird_menu.calculate_bill(['salumeria plate','mushroom ravioli(vegan)']))

you spelled it differently in the early_bird_items dictionary and the list on the last line.
'mushroom ravioli (vegan)'
and
'mushroom ravioli(vegan)'
Notice that one has a space where the other doesn’t.

1 Like