Hello, I’m having some trouble fixing my code…in this lesson: https://www.codecademy.com/paths/computer-science/tracks/cspath-cumulative-art-marketplace/modules/cspath-veneer/projects/veneer
Here is my code so far:
class Art:
def __init__(self, artist, title, medium, year, owner):
self.artist = artist
self.title = title
self.medium = medium
self.year = year
self.owner = owner
def __repr__(self):
return '''{artist}. "{title}". {year}, {medium}. {owner}, {location}.'''.format(artist = self.artist, title = self.title, year = self.year, medium = self.medium, owner = self.owner.name, location = self.owner.location)
class Marketplace:
def __init__(self):
self.listings = []
def add_listing(self, new_listing):
self.listings.append(new_listing)
def remove_listing(self, old_listing):
self.listings.remove(old_listing)
def show_listings(self):
for listing in self.listings:
print(listing)
class Client:
def __init__(self, name, location, is_museum):
self.name = name
if is_museum == True:
self.location = location
else:
self.location = "private collection"
def sell_artwork(self, artwork, price):
if artwork.owner == self:
new_listing = Listing(artwork, price, self)
veneer.add_listing(new_listing)
class Listing:
def __init__(self, art, price, seller):
self.art = self
self.price = price
self.seller = seller
def __repr__(self):
return "{title}, {price}.".format(title = self.art.title, price = self.price)
veneer = Marketplace()
print(veneer.show_listings())
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)", "oil on canvas", 1910, edytta)
print(girl_with_mandolin)
edytta.sell_artwork(girl_with_mandolin, "$6M (USD)")
veneer.show_listings()
It’s at the string representation in the Listing class:
AttributeError: ‘Listing’ object has no attribute ‘title’
Thanks for the help!!