← Back to Classes
Question 488
Cat Keeps The Sound
Cat Keeps The Sound
A Cat is an Animal with one extra attribute, indoor. Write the body of the Cat constructor: hand name to the parent constructor with super().__init__ so the inherited speak still finds self.name, then store indoor on the object. Do NOT write a main block or any top-level test code; the tests construct the class. Input: two lines, a name and then yes or no, which the tests read (the second becomes a bool) and pass to the constructor before calling speak and printing the indoor attribute.
Expected Output:
Tom makes a sound. True
= newline. The output ends with a newline — print one after the last line.
Hints2 available
Sign in to use hintsTopics:
ClassesInheritance
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.