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
A _______ occurs when access to a website is interrupted because there are to many simultaneous requests, and result in a ______
rjkz [21]

Answer:time out then denial of service

Explanation:

Cause I did it.

3 0
3 years ago
On a web page coded in HTML, there is a sentence that reads, "Welcome to Assessments Section." Sam wants to insert the word "the
Natalka [10]

Answer:

The inserted text will appear as underlined text. The deleted text will appear as strike through text.

Explanation:

In HTML the text which has been inserted will appear as underlined text. It means if we insert something in HTML then it will underline it. This will highlight the text that has been inserted. While on the other hand if we delete some text and replace it with some other text, then it will appear as strikethrough text.

Strikethrough text is the text which is represented with a horizontal line in its center. It represents those words which are added by mistake and are not meant for inclusion.

7 0
4 years ago
A fire caused by a person falling asleep with a lit cigarette is an example of a(n) __________ fire.
xz_007 [3.2K]

A fire caused by a person falling asleep with a lit cigarette is an example of a(n) accidental fire.

Cigarettes include irritants that could cause these tissues to expand, which would then result in the obstruction that causes snoring and sleep apnea. The possibility of dozing off while smoking is another risk of smoking, particularly before bed. This raises the possibility of fire or perhaps burn injury.

<h3>What is Accidental fire ?</h3>

Accidental fires are ones for which there is no clear evidence that a person intentionally started or spread the fire. While this categorisation is obvious in the majority of cases, some intentionally started fires can be unintentional. An engineer intentionally starting a fire, for instance, by turning off a boiler.

  • electricity supply or other electrical equipment and appliances, cooking, or cooking appliances (cookers, ovens, hotplates, grill pans, deep-fat fryers, microwaves, and toasters).

Learn more about Accidental fire here:

brainly.com/question/27537283

#SPJ4

6 0
2 years ago
Explain computer software in detail with the help of proper examples
Brums [2.3K]
Computer software, or simply software, is a part of a computer system that consists of data or computer instructions, in contrast to the physical hardware from which the system is built. In computer science and software engineering, computer software is all information processed by computer systems, programs and data. Computer software includes computer programs, libraries and related non-executable data, such as online documentation or digital media. Computer hardware and software require each other and neither can be realistically used on its own.
8 0
4 years ago
The only item on the desktop of a new Mac is the hard-drive icon. <br><br> True or false?
Andre45 [30]

Answer:

False

There are many more items on the desktop of a new Mac than the hard-drive icon.

3 0
4 years ago
Other questions:
  • Changeover means that ____. (select all that apply)
    7·2 answers
  • He primary purpose for attackers to send port scanning probes to hosts is to identify which ports are open. true false
    5·1 answer
  • Counting calculus students. About A university offers 3 calculus classes: Math 2A, 2B and 2C. In both parts, you are given data
    6·1 answer
  • 50 POINTS<br><br>Question linked in file below.
    5·1 answer
  • 2. What are the 3 Alternative software programs that can be used if you don’t have the Microsoft Office programs?
    8·2 answers
  • What are the trinity of the computer system
    15·1 answer
  • SLA:
    14·1 answer
  • Which situation is the best choice for using telehealth?
    12·1 answer
  • Which insert image option allows a user to insert images from the internet?
    5·2 answers
  • Given integer variables totalTickets, vipTickets, and sessionNum, which line of code correctly calls the following function? voi
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!