In step 10 of the Basta Fazoolin project you are asked to create a calculate_bill method. The following code works but I would like to know why self.items has purchased_item in square brackets?
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
I can’t find reference to it in past lessons. If anyone has the answer and possibly a link to a reference so I can read a bit about it it would be appreciated.