Question: Now write a class named Kangaroo as a subclass of Marsupial that inherits all the attributes of Marsupial and also: extends the Marsupial __init__ constructor

Now write a class named Kangaroo as a subclass of Marsupial that inherits all the attributes of Marsupial and also: extends the Marsupial __init__ constructor to take, as input, the coordinates x and y of the Kangaroo object, supports method jump that takes number values dx and dy as input and moves the kangaroo by dx units along the x-axis and by dy units along the y-axis, and overloads the __str__ operator so it behaves as shown below. >>> k = Kangaroo(0,0)>>> print(k)I am a Kangaroo located at coordinates (0,0). My pouch is empty.>>> k.put_in_pouch('doll')>>> k.put_in_pouch('firetruck')>>> k.put_in_pouch('kitten')>>> k.pouch_contents()['doll', 'firetruck', 'kitten']>>> k.jump(1,0)>>> k.jump(1,0)>>> k.jump(1,0)>>> print(k)I am a Kangaroo located at coordinates (3,0) My pouch contains a doll, firetruck, and kitten.

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!