What are the only three moves a subclass can make that its parent had not already made?
Short drills on what this video just taught. Write the code, run the checks, and reveal the answer only if you are stuck.
A subclass mirrors a subset: a category can only be a child of Animal if every one of its members is already an animal. animal_ids holds the ids of the twenty-eight creatures and groups holds five candidate categories.
Assign to subset_groups the names of the groups that are genuine subsets of the animal set, as a list of strings sorted alphabetically.
Hint: a Python set has an .issubset() method, and sorted() returns a sorted list.
A subclass as a subset of the parent type
State that all twenty-eight creatures are animals, defined by how long they have been alive, and list the subsets: a cat with a pattern, a person with a list of friends, a nameless wild rabbit.
Nested hierarchies and the base-class vocabulary
Record that Student sits under Person, which sits under Animal, so a student carries everything a person and an animal carry plus a major, and name Animal the base, parent or superclass.
Add data, add behavior, override behavior
List the three moves with one example each: a friends list as new data, speak as new behavior, and a Student.speak printing i have homework where Person.speak printed hello.