Live coding today! We will design and implement classes for various animals (Animal, Fish, Bird, Penguin, and Parrot). What is an appropriate hierachy? What class and instance attributes do we need? Can we have default values for some attributes? What methods do we need and which ones should we override?

There is no new reading assigned, but be sure to review the slides and your notes from the last two lectures so that you're ready to start applying what was discussed. Then read the slides and the skeleton file below and think about the questions asked. We'll complete the implementation of the classes together in lecture.


Lecture materials

Slides: individual slides for viewing, 6-up layout for printing

Examples:

Lecture Recording

Answers to the questions on slides 6, 8, and 9 are D, D, and B, respectively.

Do after lecture

Complete the file zoology.py by implementing the subclasses Parrot and Penguin. You can design them as you wish--this is just for practice--but you can use the ideas below if you want to match your code to ours, which we will post on May 6th is now posted:

After you complete the class definitions, check out this module that sets up a zoo! The given module creates a Zoo and lets you interact with the animals. You can play a little at the zoo, and then read the code to see how we use Animal and its subclasses.