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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started