This is from the classes python3 course. I can include the whole code if thats helpful, but I am just trying to understand why it works. Where is it signifiing to add the values into the bill? New to python, but I assumed you would do something like bill += self.items[values]. Don’t know if that question makes sense so happy to ellaborate more if needed
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)