Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Deductive And Object Oriented Databases Second International Conference Dood 91 Munich Germany December 18 1991 Proceedings Lncs 566

Authors: Claude Delobel ,Michael Kifer ,Yoshifumi Masunaga

1st Edition

3540550151, 978-3540550150

More Books

Students also viewed these Databases questions

Question

What is IUPAC system? Name organic compounds using IUPAC system.

Answered: 1 week ago

Question

What happens when carbonate and hydrogen react with carbonate?

Answered: 1 week ago

Question

2. Define communication.

Answered: 1 week ago