Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.


+4 votes

How do you use food1.addBacon() ? im getting the error "Food object has no attribute 'addBacon'"

asked in CSC201 Spring 2021 by (8 points)

2 Answers

+3 votes

that should mean you have not defined addBacon() in your class definition. do you have def addBacon(self): in your class definition?

answered by (8 points)

no i did not, thank sm


got it thank u !

+2 votes

since the code was already submitted, i am just gonna give you the ode i used for it:
def addBacon(self):

    self.name = self.name + ' with bacon'
    self.price = self.price + 3
    self.vegStatus = False
answered by (8 points)