[We hope that you can view the videos! However, if your internet connection is too slow for viewing videos, download the audio file (mp4) and the slides (pdf). Then you can listen to the audio as you go through the slides.]
We use the class definition syntax that we learned from the previous lecture to build a game! First we'll design the class, i.e., our own custom type; then we implement the class in order to create a word guessing game. Along the way, we discuss how to overload special methods.
Slides for all 3 videos of this lecture: individual slides for viewing and a "6-up" version for printing.
In this segment, we discuss some of Python's special methods and the steps for designing a class--a custom type.
To facilitate the creation of a word guessing game, we design and implement a class, SecretWord
.
We can "overload" Python operators to perform specialized operations that we define for our custom type.