1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
allochka39001 [22]
3 years ago
9

Define the Artist class with a constructor to initialize an artist's information and a print_info() method. The constructor shou

ld by default initialize the artist's name to "None" and the years of birth and death to 0. print_info() should display Artist Name, born XXXX if the year of death is -1 or Artist Name (XXXX-YYYY) otherwise.
Define the Artwork class with a constructor to initialize an artwork's information and a print_info() method. The constructor should by default initialize the title to "None", the year created to 0, and the artist to use the Artist default constructor parameter values.

Ex: If the input is:

Pablo Picasso
1881
1973
Three Musicians
1921
the output is:

Artist: Pablo Picasso (1881-1973)
Title: Three Musicians, 1921
If the input is:

Brice Marden
1938
-1
Distant Muses
2000
the output is:

Artist: Brice Marden, born 1938
Title: Distant Muses, 2000
class Artist:
# TODO: Define constructor with parameters to initialize instance attributes
# (name, birth_year, death_year)

# TODO: Define print_info() method. If death_year is -1, only print birth_year


class Artwork:
# TODO: Define constructor with parameters to initialize instance attributes
# (title, year_created, artist)

# TODO: Define print_info() method


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()
Computers and Technology
1 answer:
nika2105 [10]3 years ago
8 0

Answer:

class Artist():

   def __init__(self, artist_name=None, artist_birth_year=0, artist_death_year=0):

       self.artist_name = artist_name

       self.artist_birth_year = artist_birth_year

       self.artist_death_year = artist_death_year

   def display_artist(self):

       if self.artist_death_year == -1:

           print('{}, born {}'.format(self.artist_name, self.artist_birth_year))

       else:

           print('{} ({}-{})'.format(self.artist_name, self.artist_birth_year, self.artist_death_year))

class Artwork():

   def __init__(self, artwork_title=None, artwork_year_created=0, artist=Artist()):

       self.artwork_title = artwork_title

       self.artwork_year_created = artwork_year_created

       self.artist = artist

   def display_artist(self):

       print('artwork_title: {}'.format(self.artwork_title))

       print('Artist: ', end='')

       self.artist.display_artist()

def main():

   user_artist_name = input('Enter the name of artist: ')

   user_birth_year = int(input('Enter birth year: '))

   user_death_year = int(input('Enter death year: '))

   user_title = input('Enter master piece title: ')

   user_year_created = int(input('Enter year created: '))

   user_artist = Artist(user_artist_name, user_birth_year, user_death_year)

   new_artwork = Artwork(user_title, user_year_created, user_artist)

   new_artwork.display_artist()

if __name__ == "__main__":

   main()

Explanation:  

  • Inside the constructor of Artist class, initialize the essential properties.
  • Create the display_artist function that checks whether artist_death_year is equal to -1 and then displays an appropriate message according to the condition.
  • Apply the similar steps as above for the Artwork class.
  • Inside the main method, get the information from user and finally call the display_artist function to print the results on screen.
You might be interested in
Distinguish between a computer drive and computer driver​
rewona [7]

Answer:

The word Drive typically refers to a mechanical hard drive or solid-state hard drive used to store the OS, data and programs. A driver is software code that interfaces the various devices in the computer with the processing system.

Explanation:

..............................................................

6 0
2 years ago
________ refers to the ability to model components and show how the components' inputs and outputs relate to one another.
Black_prince [1.1K]

Answer:

Central Processing Unit

Explanation:

When the CPU puts the address of a peripheral onto the address bus, the input–output interface decodes the address and identifies the unique computer peripheral with which a data transfer operation is to be executed.

5 0
3 years ago
You can perform numbers___on binary
Masja [62]

Answer:

c) arithmetic operations

3 0
2 years ago
Read 2 more answers
11.How would you characterize the relative range of paths forecasted by the various computer models on August 25
larisa86 [58]

Answer:

Following are the solution to this question:

Explanation:

There is some difference between both the path expected by different computer simulations on 25 August. There is also some variance between 50 km to 500 km in the predicted route but the path is also unique in each model evaluation. It might be because any and every possible situation is repeated by the computer program. Many simulations will focus mostly on variations of strain, one might focus on the temperature variation, or one might concentrate on certain variables. But each model suggests all and every parameter which is inserted during a very photographer's encoding. There are therefore several possibilities of variability in forecasting the Hurricane's course. Here and some forecasts have shown that hurricanes would pass through Florida fully, and also some models have shown that hurricanes would pass thru the Gulf Coast, accompanied by the areas of Mississippi or Louisiana. This is the real difference in the direction of these models.

3 0
2 years ago
All of the following are potential benefits of blogging except
Archy [21]
The answer should be C because most bloggers sacrifice privacy for content.
8 0
3 years ago
Read 2 more answers
Other questions:
  • 1.using synonyms can help make ur writing more________
    11·1 answer
  • Which motherboard slot has direct access to the north bridge?
    7·1 answer
  • What is the quickest option for adding internet images to a power point presentation
    7·1 answer
  • Mrs. Jackson wrote a newsletter to the customers of her housecleaning business that included some organizational tips they could
    8·2 answers
  • Steps to log out of an email account ​
    5·2 answers
  • A(n) _____ is a request for the database management software to search the database for data that match criteria specified by th
    15·2 answers
  • Can you please answer the question in the picture ! :)
    6·1 answer
  • Write a code that takes numbers from the user as a list. (User can enter as many numbers as he wants). Then, find mean and stand
    15·1 answer
  • Does anyone know how many Brainliests you need to be able to send a private message to someone??
    10·2 answers
  • Which option identifies the programming paradigm selected in thr following scenario? A student is writing a science fiction stor
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!