May I please have your assistance with this lab: 2.15 LAB: Artwork label ( modules) Part of the code is correct. I am only needing the code to be correct for the following errors: This is the current code & errors at bottom of code: # Artist.py class Artist: # below is the comstructor to initializez artist infomration # constructor initialize the artist's name to "None" and the years of birth and death to 0 def __init__(self, name='None', birth_year=0, death_year=0): self.name = name self.birth_year = birth_year self.death_year = death_year def print_info(self): if self.birth_year >= 0 and self.death_year >= 0: print(f'Artist: {self.name} ({self.birth_year} to {self.death_year})') elif self.birth_year >= 0: print(f'Artist: {self.name} ({self.birth_year} - present)') else: print(f'Artist: {self.name} (unkown)') # Artwork.py class Artwork: def __init__(self, title= "None", year_created=0, artist=Artist()): self.title = title self.year_created = year_created self.artist = artist def print_info(self): self.artist.print_info() print(f'Title: {self.title}, {self.year_created}') # Main.py if __name__ == "__main__": user_artist_name = input() user_birth_year = int(input()) user_death_year = int(input()) user_title = input() user_year_created = int(input()) user_artist = Artist(user_artist_name, user_birth_year, user_death_year) new_artwork = Artwork(user_title, user_year_created, user_artist) new_artwork.print_info() Current Errors: 4:Unit testkeyboard_arrow_up 0 / 2 Tests Artist constructor with default param values AttributeError: 'Artist' object has no attribute 'name' 5:Unit testkeyboard_arrow_up 0 / 2 Tests that Artist('Pablo Picasso', 1881, 1973) correctly initializes artist TypeError: Artist() takes no arguments 6:Unit testkeyboard_arrow_up 0 / 2 Tests that Artist('Brice Marden', 1938, -1) correctly initializes artist TypeError: Artist() takes no arguments 7:Unit testkeyboard_arrow_up 0 / 1 Tests Artwork constructor with default param values AttributeError: 'Artwork' object has no attribute 'title' Please see attached lab and error messages. Thank you.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
May I please have your assistance with this lab: 2.15 LAB: Artwork label ( modules) Part of the code is correct. I am only needing the code to be correct for the following errors: This is the current code & errors at bottom of code: # Artist.py class Artist: # below is the comstructor to initializez artist infomration # constructor initialize the artist's name to "None" and the years of birth and death to 0 def __init__(self, name='None', birth_year=0, death_year=0): self.name = name self.birth_year = birth_year self.death_year = death_year def print_info(self): if self.birth_year >= 0 and self.death_year >= 0: print(f'Artist: {self.name} ({self.birth_year} to {self.death_year})') elif self.birth_year >= 0: print(f'Artist: {self.name} ({self.birth_year} - present)') else: print(f'Artist: {self.name} (unkown)') # Artwork.py class Artwork: def __init__(self, title= "None", year_created=0, artist=Artist()): self.title = title self.year_created = year_created self.artist = artist def print_info(self): self.artist.print_info() print(f'Title: {self.title}, {self.year_created}') # Main.py if __name__ == "__main__": user_artist_name = input() user_birth_year = int(input()) user_death_year = int(input()) user_title = input() user_year_created = int(input()) user_artist = Artist(user_artist_name, user_birth_year, user_death_year) new_artwork = Artwork(user_title, user_year_created, user_artist) new_artwork.print_info() Current Errors: 4:Unit testkeyboard_arrow_up 0 / 2 Tests Artist constructor with default param values AttributeError: 'Artist' object has no attribute 'name' 5:Unit testkeyboard_arrow_up 0 / 2 Tests that Artist('Pablo Picasso', 1881, 1973) correctly initializes artist TypeError: Artist() takes no arguments 6:Unit testkeyboard_arrow_up 0 / 2 Tests that Artist('Brice Marden', 1938, -1) correctly initializes artist TypeError: Artist() takes no arguments 7:Unit testkeyboard_arrow_up 0 / 1 Tests Artwork constructor with default param values AttributeError: 'Artwork' object has no attribute 'title' Please see attached lab and error messages. Thank you.
2.15 LAB: Artwork label (modules)

Define the Artist class in Artist.py with a constructor to initialize an artist's information. The constructor should by default initialize the artist's name to "unknown" and the years of birth and death to -1.

Define the Artwork class in Artwork.py with a constructor to initialize an artwork's information. The constructor should by default initialize the title to "unknown", the year created to -1, and the artist to use the Artist class's default constructor parameter values. Add an import statement to import the Artist class.

Add import statements to main.py to import the Artist and Artwork classes.

Ex: If the input is:

```
Pablo Picasso
1881
1973
Three Musicians
1921
```

the output is:

```
Artist: Pablo Picasso (1881 to 1973)
Title: Three Musicians, 1921
```

Ex: If the input is:

```
Brice Marden
1938
-1
Distant Muses
2000
```

the output is:

```
Artist: Brice Marden (1938 to present)
Title: Distant Muses, 2000
```

Ex: If the input is:

```
Banksy
-1
-1
Balloon Girl
2002
```

the output is:

```
Artist: Banksy (unknown)
Title: Balloon Girl, 2002
```
Transcribed Image Text:2.15 LAB: Artwork label (modules) Define the Artist class in Artist.py with a constructor to initialize an artist's information. The constructor should by default initialize the artist's name to "unknown" and the years of birth and death to -1. Define the Artwork class in Artwork.py with a constructor to initialize an artwork's information. The constructor should by default initialize the title to "unknown", the year created to -1, and the artist to use the Artist class's default constructor parameter values. Add an import statement to import the Artist class. Add import statements to main.py to import the Artist and Artwork classes. Ex: If the input is: ``` Pablo Picasso 1881 1973 Three Musicians 1921 ``` the output is: ``` Artist: Pablo Picasso (1881 to 1973) Title: Three Musicians, 1921 ``` Ex: If the input is: ``` Brice Marden 1938 -1 Distant Muses 2000 ``` the output is: ``` Artist: Brice Marden (1938 to present) Title: Distant Muses, 2000 ``` Ex: If the input is: ``` Banksy -1 -1 Balloon Girl 2002 ``` the output is: ``` Artist: Banksy (unknown) Title: Balloon Girl, 2002 ```
The image shows the results of a series of unit tests related to the construction of `Artist` and `Artwork` objects. 

### Detailed Explanation:

1. **4th Unit Test (0/2):** 
   - **Test Description:** Tests the `Artist` constructor with default parameter values.
   - **Error Message:** `AttributeError: 'Artist' object has no attribute 'name'`
   - **Explanation:** This error indicates that there is an attempt to access an attribute `name` that does not exist in the `Artist` class when using default parameters.

2. **5th Unit Test (0/2):**
   - **Test Description:** Tests that `Artist(Pablo Picasso, 1881, 1973)` correctly initializes the artist.
   - **Error Message:** `TypeError: Artist() takes no arguments`
   - **Explanation:** The error suggests that the `Artist` class constructor is not designed to accept arguments, but arguments were provided during initialization.

3. **6th Unit Test (0/2):**
   - **Test Description:** Tests that `Artist(Brice Marden, 1938, -1)` correctly initializes the artist.
   - **Error Message:** `TypeError: Artist() takes no arguments`
   - **Explanation:** Similar to the 5th test, the constructor is not accepting arguments as expected, leading to a `TypeError`.

4. **7th Unit Test (0/1):**
   - **Test Description:** Tests the `Artwork` constructor with default parameter values.
   - **Error Message:** `AttributeError: 'Artwork' object has no attribute 'title'`
   - **Explanation:** This error points out that the `Artwork` class is missing a `title` attribute when default parameters are used.

### Additional Information:
- Below the unit tests, there is a section labeled "5 previous submissions" with two time stamps: 11:27 AM on 10/24/22 and 11:18 AM on 10/24/22. The submissions scored 3/10 and 0/10 respectively, with an option to view more information.
Transcribed Image Text:The image shows the results of a series of unit tests related to the construction of `Artist` and `Artwork` objects. ### Detailed Explanation: 1. **4th Unit Test (0/2):** - **Test Description:** Tests the `Artist` constructor with default parameter values. - **Error Message:** `AttributeError: 'Artist' object has no attribute 'name'` - **Explanation:** This error indicates that there is an attempt to access an attribute `name` that does not exist in the `Artist` class when using default parameters. 2. **5th Unit Test (0/2):** - **Test Description:** Tests that `Artist(Pablo Picasso, 1881, 1973)` correctly initializes the artist. - **Error Message:** `TypeError: Artist() takes no arguments` - **Explanation:** The error suggests that the `Artist` class constructor is not designed to accept arguments, but arguments were provided during initialization. 3. **6th Unit Test (0/2):** - **Test Description:** Tests that `Artist(Brice Marden, 1938, -1)` correctly initializes the artist. - **Error Message:** `TypeError: Artist() takes no arguments` - **Explanation:** Similar to the 5th test, the constructor is not accepting arguments as expected, leading to a `TypeError`. 4. **7th Unit Test (0/1):** - **Test Description:** Tests the `Artwork` constructor with default parameter values. - **Error Message:** `AttributeError: 'Artwork' object has no attribute 'title'` - **Explanation:** This error points out that the `Artwork` class is missing a `title` attribute when default parameters are used. ### Additional Information: - Below the unit tests, there is a section labeled "5 previous submissions" with two time stamps: 11:27 AM on 10/24/22 and 11:18 AM on 10/24/22. The submissions scored 3/10 and 0/10 respectively, with an option to view more information.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Program on Numbers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education