I was following a tutorial on setting up a class for an example of making a bar bill and cant figure out why i got error when adding new item to the bill
'dict' object has no attribute 'append'
The code
class Bar_tab:
#dictionary
menu = {
'wine':5,
'beer':2,
'coke':3,
'chicken':9,
'dessert':7
}
#set up the class
def __init__(self):
#set up empty initial total and item list
#customer will add items and total will add up
#these variables will exist within the class
self.total = 0
self.items = {}
#function for add items to tab
def add(self,item):
self.items.append(item)
#add the value from menu dictionary for the 'item'
self.total += self.menu[item]
def pay_bill (self,tax,service):
#tax will only exist within this function in the class
tax=(tax/100) *self.total
service=(service/100)*self.total
total=self.total + tax + service
for items in self.items:
print(f'{item} ${self.menu[item]}')
print(f'Total is ${total}')`
Error was on the self.items.append(item)
line