it is right code but showing error please help me
Your area
method needs to be indented under the class.
Mark rows 4 and 5 together then press TAB.
thamk you it is very helpfull
The code body is missing. When this is the case, we write, pass
in place of the missing/future code.
class Foo:
pass
ohhh thank you it is very helpfull
Have you created a class instance named, brunch
?
yes but it is showing error i also don’t know what problem is happening
Please post your entire code as raw text, not a screen shot or Codebyte.
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 Menu
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)
print(brunch.calculate_bill([‘pancakes’, ‘home fries’, ‘coffee’]))
Early bird Menu
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)
Dinner Menu
dinner_items = {
‘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,
}
dinner_menu = Menu(‘Dinner’, dinner_items, 1700, 2300)
kids Menu
kids_items = {
‘chicken nuggets’: 6.50, ‘fusilli with wild mushrooms’: 12.00, ‘apple juice’: 3.00
}
kids_menu = Menu(‘Kids’, dinner_items, 1700, 2300)
There does not appear to be a brunch
instance. There is a brunch_menu
instance, though. Is that what your meant to write?