Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+5 votes

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

asked in CSC201 Spring 2021 by (1 point)

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 (1 point)
0

no i did not, thank sm

0

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 (1 point)
...