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
Do you think it’s better for a young designer to use free, open-source art programs or to pay for commercial programs? Explain y
kipiarov [429]

Answer:

I think that if you are starting you should use a free, open-source art program. Because starting up with alot of things like this is hard with no money but the resources that we have could help with that. That's why I think the free one is better than paying, especially monthly pay.

Explanation:

3 0
3 years ago
Complete the following table.
Yanka [14]

Answer:

Only one aspect is left, and that is to record the solution

Explanation:

When we study software architecture these days, we also study design patterns. You must have got the message like let so and so company know what problem you faced or your findings, for research purposes. And this is what gives an insight into the requirement of the design pattern. Always make an habit to record your findings in proper world, and also tick mark the option mentioned above while installing the IDE. Your design pattern will be automatically picked. And if its awesome, you can be rewarded as well.

3 0
3 years ago
The set of specific, sequential steps that describe exactly what a computer program must do to complete the work is called a(n)
nataly862011 [7]

Answer:

D). Algorithm

Explanation:

The set of specific, sequential steps that describe exactly what a computer program must do to complete the work is called an algorithm.

From the question, it is clear the correct option is algorithm.

In simple terms, to solve a problem the set of rules to follow is called algorithm. Algorithm in computer programming describes the steps that explains not only the task that needs to be performed, but also how to do it.

In algorithm, the steps are needed to be in the right sequence.

6 0
3 years ago
Read 2 more answers
On what basis can you categorize the generations of computers?
murzikaleks [220]

commercial computer age is from UNIVAC (Universal Automatic Computer)

8 0
3 years ago
2.2-2 Consider sorting numbers stored in array by first finding the smallest element n A of and exchanging it with the element i
True [87]

Answer:

Follows are the explanation of the choices:

Explanation:

Following are the Pseudocode for selection sort:                      

for j = 0 to k-1 do:

      SS = i

      For l = i + 1 to k-1 do:

        If X(l) < X(SS)

          SS= l

        End-If

      End-For

      T = X(j)

      X(j) = X(SS)

      X(SS) = T

    End-For

Following are the description of Loop invariants:

The subarray  A[1..j−1] includes the lowest of the j−1 components, ordered into a non-decreasing order, only at beginning of the iteration of its outer for loop.  

A[min] is the least amount in subarray A[j.. l−1] only at beginning of the each loop-inner iterations.                      

Following are the explanation for third question:

Throughout the final step, two elements were left to evaluate their algorithm. Its smaller in A[k-1] would be placed as well as the larger in A[k]. One last is the large and medium component of its sequence because most and the last two components an outer loop invariant has been filtered by the previous version. When we do this n times, its end is a repetitive, one element-sorting phase.

Following is the description of choosing best-case and worst-case in run- time:

The body the if has never been activated whenever the best case time is the list is resolved. This number of transactions are especially in comparison also as a procedure, that will be (n-1)(((n+2)/2)+4).    

A structure iterator at every point in the worst case that array is reversed, that doubles its sequence of iterations in the inner loop, that is:(n−1)(n+6) Since both of them take timeΘ(n2).

7 0
3 years ago
Other questions:
  • What can be determined from this selection? Check all that apply. The Tax Info worksheet is currently being viewed. There are th
    6·2 answers
  • Create a text file that contains your expenses for last month in the following categories: • Rent • Gas • Food • Clothing • Car
    13·1 answer
  • In your own words, explain the role of scientific investigation in the development of the Theory of Evolution.
    6·1 answer
  • How to find i with superposition method
    8·1 answer
  • laire writes a letter to her grandmother, in which she describes an amusement park she visited last week. She adds pictures of t
    11·1 answer
  • Were does igneous rocks cool?
    9·1 answer
  • I had tried to turn on Linux on the Chromebook but it's not working
    11·2 answers
  • How are Earth's plates made?
    14·1 answer
  • Write an application that allows a user to input the height and width of a rectangle. It should output the area and perimeter of
    10·1 answer
  • Which are the 2 main elements that’s make up computer architecture?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!