Veneer Project - Transferring Ownership

I know this is a walkthrough project but I did it without seeing and am getting errors. After seeing the walkthrough also I cannot figure out what has gone wrong. Can someone help me out?

class Art:
  def __init__(self, artist, title, year,medium, owner):
    self.artist = artist
    self.title = title
    self.medium = medium
    self.year = year
    self.owner = owner

  def __repr__(self):
    return "{}. \"{}\". {}, {}. {}, {}".format(self.artist, self.title, self.year, self.medium,, self.owner.location)

class Marketplace:
  def __init__(self):
    self.listings = []

  def add_listing(self, new_listing):

  def remove_listing(self, listing):

  def show_listings(self):
    for i in self.listings:

class Client:
  def __init__(self, name, location, is_museum): = name
    self.is_museum = is_museum
    if is_museum:
      self.location = location
      self.location = "Private Collection"

  def sell_artwork(self, artwork, price):
    if artwork.owner == self:
      new_listing = Listing(artwork, price, self)

  def buy_artwork(self, artwork):
    if artwork.owner != self:
      art_listing = None
      for listing in veneer.listings:
        if == artwork:
          art_listing = listing
      if art_listing != None: =

class Listing:
  def __init__(self, art, price, seller): = art
    self.price = price
    self.seller = seller

  def __repr__(self):
    return "{}, {}.".format(, self.price)

veneer = Marketplace()

edytta = Client("Edytta Halpirt", None, False)

moma = Client("The MOMA", "New York", True)

girl_with_mandolin = Art("Picasso, Pablo", "Girl with a Mandolin(Fanny Tellier", 1910, "oil on canvas", edytta)

edytta.sell_artwork(girl_with_mandolin, "6M(USD")



In your buy_artwork method of the Client class, you have this: =

What is the purpose of that statement, and does it accomplish that purpose?

Edited on August 10, 2020 to add the following:

Link to project page: Create an Art Marketplace: Veneer

The following are links to other Codecademy Forums threads related to this project:

It’s changing the owner name of the artwork to the client who is buying it. I don’t know if it is working as it is throwing an error

When you first assign an .owner to an Art instance, what do you use?

1 Like

However, we need to be thinking of a person or museum as being a different object from that person or museum’s name. Though people may call other people or institutions by their names. they are much more than just their names, and that is reflected in how this project is structured. Names are one of many attributes of an object. The same applies to Client instances. What object actually represents a Client instance in the sell_artwork method of Client in this project?

Edited on August 5, 2020 to add some detail to the post

1 Like

is it artwork.owner == self?

To answer that question, we need to consider what object self refers to in that context. Does self refer to the Client instance that is buying the artwork?

yes self refers to the name of the client who is being the artwork.

Actually, self refers to the instance of Client that is buying the artwork.

Do you have the buy_artwork method of the Client class working correctly now? If not, please post your current version of that method.

Edited on August 7, 2020 to suggest that the user post code

1 Like

no I don’t think buy artwork is working properly as the name isn’t getting changed and I cannot print it out. my code is:

def buy_artwork(self, artwork):
    if artwork.owner != self:
      art_listing = None
      for listing in veneer.listings:
        if == artwork:
          art_listing = listing
      if art_listing != None: =

Let’s focus on this if block:

      if art_listing != None: =

If the condition evaluates to True, it’s because in the preceding for loop, we found that the work of art that the current instance of Client wished to purchase was, indeed, among the listings. Therefore, we can proceed with the transfer to the new owner and with the work of art’s removal from the listings.

Now let’s look at this line within the if block, which is where we need to perform the transfer of ownership: =

The variable to the left of the assignment operator,, is correct, in that it is what we need to set to the new owner. It is what is to the right of the operator that is now in question.

Who is the new owner? It is, in fact, the current instance of Client. How do we refer to that instance? The answer is in the header of the buy_artwork method of Client, which is:

 def buy_artwork(self, artwork):

The name given to the first argument of a method refers to the instance from which the method is being called, and specifically in this case, to the Client that is buying the work of art. Therefore, self is what needs to be to the right of the assignment operator.

That should take care of it. That instance of Client will then be the new owner. All the attributes of that instance of Client, including name, will be carried along with the object that represents that instance.


I have done exactly this but still cannot print out the new owners name and location after update of the owner. That is what I cannot solve

Hi @rameezrazariaz306094,

Begin with the code that you have in this post. Then edit only this line: =

It should be changed to the following: = self

That is because in the buy_artwork method of Client, self refers to the instance that is buying the work of art.

After that change, you should get this output:

Picasso, Pablo. "Girl with a Mandolin(Fanny Tellier". 1910, oil on canvas. The MOMA, New York
1 Like

Alright Thanks, man. That’s exactly what I needed

1 Like