Question: This problem will allow you to demonstrate your understanding of Object - Oriented Programming ( OOP ) in Python by creating a simple Painter and

This problem will allow you to demonstrate your understanding of Object-Oriented Programming (OOP) in Python by creating a simple Painter and Paintings Management System for a gallerys collection. This will reinforce the use of classes, creating class attributes (variables), instance methods, and overriding special methods.
Instructions:
An art gallery wants to manage its collection of paintings and painters more efficiently. They would like to create a Python program to help with this task. The following requirements need to be implemented:
Create a Painter class with the following instance attributes:
name (the artists name)
dob (the authors date of birth)
nationality (the authors nationality)
paintings (a list to store all paintings created by the artist)
The Painter class must also have a list named all_painters that stores all Painter objects that get instantiated. Be sure to add the painter to this list when a new painter is created (in the __init__ method). This list will be used to add paintings to the gallery collection.
Create a method named paint() in the Painter class that takes the following parameters:
title (the title of the artwork)
year (the year the painting was created)
The paint() method in the Painter class must create a new Painting object (described below) with the Painter instance as its painter and add it to the painters list of paintings.
Create a Painting class with the following instance attributes:
title (the title of the painting)
painter (an instance of the Painter class)
year (the year the painting was created)
The Painting class must also have a list named all_paintings that stores all Painting objects that get instantiated. Be sure to add the painting to this list when a new painting is created (in the __init__ method). This list will be used to add paintings to the gallery collection.
The Painting class must override the __str__() method to return the paintings details in this format:
Title:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!