Question: Look at the following class definition: class Bird: def _ _init_ _(self, bird_type): self._ _bird_type = bird_type Write the code for a class named Duck

Look at the following class definition:

class Bird:

def _ _init_ _(self, bird_type):

self._ _bird_type = bird_type

Write the code for a class named Duck that is a subclass of the Bird class. The Duck class’s _ _init_ _ method should call the Bird class’s _ _init_ _ method, passing ‘duck’ as an argument.

Step by Step Solution

3.43 Rating (162 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To create a class named Duck that is a subclass of the Bird class we can use the following c... View full answer

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 Starting Out With Python Questions!