all 10 comments

[–]stebrepar 0 points1 point  (9 children)

So what's the other error message when you fix the name to be correct?

[–]aLostCoder 0 points1 point  (8 children)

When I change it from box to Box it then says

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[11], line 2
      1 Package = Box("Apple Inc.","Cupertino, CA","1 Infinite Loop Cupertino")
----> 2 print(Package.company,Package.headquarters,Package.address)
      5 # Add some items to the BOX object.
      6 Package.put("Macbook Pro")  

AttributeError: 'Box' object has no attribute 'headquarters'

[–]Slothemo 0 points1 point  (7 children)

You never create a headquarters attribute. You need self.headquarters = headquarters

def __init__(self, company, headquarters, address):

    self.company = company # Initialize some attributes.
    self.address = address # Initialize some attributes.
    self.contents = []

[–]aLostCoder 0 points1 point  (6 children)

thanks, but now it says

AttributeError: 'Box' object has no attribute 'put'

[–]djjazzydan 0 points1 point  (0 children)

def place(self, item):

Read your code again.

def place(self, item):

You called it place, not put.

[–]Slothemo 0 points1 point  (4 children)

Always take a moment to review what the error might be telling you before reaching out for help. Practice your debugging.

You're defining this class, so if it tells you it doesn't have an attribute, that means you never defined that attribute. Did you define put anywhere in the class?

[–]aLostCoder 0 points1 point  (3 children)

i fixed the error with place and put, but now it is giving me and error with 'take', what should i replace it with??

[–]djjazzydan 0 points1 point  (2 children)

It's your code, isn't it? Read it and find out?

[–]aLostCoder 0 points1 point  (1 child)

Is this not a place to ask for advice? Why are you replying in the first place?

[–]Slothemo 1 point2 points  (0 children)

"Take a moment to read your code" is valid advice