I´m really struggling with classes and objects in Python and i would like someone to explain me the following code:
def buy_artwork(self, artwork):
if artwork.owner != self:
Because this is a method for the Client Class but uses artwork.owner and owner is from the Art class. If they are from different classes and theres was no inheritance, how this is going to associate the name of the art with the owner.
Because it’s a method with a parameter of artwork. So long as the object you pass to that parameter has a .owner attribute then it should be fine (I’d assume this would be an instance of Art).
When you post code, it is best to format it so that indentation and other important details display correctly. See How to ask good questions (and get good answers for advice regarding how to format code for posting.
Your __init__ method for Art probably will have the following header after it is completed as of instruction 19: