-
Skim-read Sec 10.2.2-10.2.3 (Object-oriented programming and Python classes, pg 330-332)
-
Try the magic methods
__getitem__
and__add__
for the familiarint
andlist
classes by typing out the boxed Sessions 10.1 and 10.2 on pages 331-332. -
Skim-read Sec 10.3.1-10.3.3 (the constructor method, accessor methods, and mutator methods, pg 333-339)
-
Try out creating the Planet class by typing out Listing 10.1 and Session 10.3 on page 334.
-
Add accessor methods to your Planet class - type out Listing 10.2 and Session 10.4 on page 336.
-
Add mutator methods to your Planet class - type out Listing 10.4 and Session 10.6 on page 339.
-
Suggested exercises: Do exercises 10.1-10.3, 10.4, 10.5ab p. 338 and exercises 10.11 p. 340 and save them in a file.
-
Suggested alternative reading (if you prefer the online interactive textbook over our paper textbook): skim-read and click run on the six pages Sec 16.2 - 16.6 of the online interactive textbook http://interactivepython.org/runestone/static/thinkcspy/ClassesBasics/toctree.html
-
(REQUIRED) DO the following reading quiz (unlimited attempts on 12 multiple-choice questions) and submit: https://moodle.gac.edu/mod/quiz/view.php?id=51910 (The quiz will be open until Monday 5pm)
Note: Understanding Python class may not be easy at first (even if you've done programming before), so we will devote many hours to this during for the rest of April and part of May.