Question: The Pet class constructor has a self parameter and three additional parameters: age, breed, and type. Input values age 1 , breed 1 , type

The Pet class constructor has a self parameter and three additional parameters: age, breed, and type. Input values age1, breed1, type1, age2, breed2, and type2 are read representing the information of two pets. Instantiate two new instances of Pet by completing the following tasks:
Assign pet1 with an instance of Pet with age1 as age, breed1 as breed, and type1 as type.
Assign pet2 with an instance of Pet with age2 as age, breed2 as breed, and type2 as type.
Click here for example
Ex: If the input is:
7
Doberman
dog
17
Bulldog
cat
then the output is:
pet1 data: 7 months old, Doberman, dog
class Pet:
def __init__(self, age, breed, type):
self.age = age
self.breed = breed
self.type = type
age1= int(input())
breed1= input()
type1= input()
age2= int(input())
breed2= input()
type2= input()
''' Your code goes here '''
print(f'pet1 data: {pet1.age} months old, {pet1.breed},{pet1.type}')
print(f'pet2 data: {pet2.age} months old, {pet2.breed},{pet2.type}')t2 data: 17 months old, Bulldog, cat

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 Databases Questions!