Session Details
Week 1,
Session 2 — Thu Dec 2
Prep
-
Zelle, §1.3, 1.5–2.4
HW Due
-
HW 1
Topics
-
Basic program structure
-
The input/compute/output pattern
-
Defining functions without parameters
-
Printing versus returning a value
-
Constructing objects
-
Using objects: dot notation for methods and instance variables
-
zellegraphics as an example of constructing and using objects
-
Robots — introduction to physical properties of the iRobot Create
Outline
-
[10 minutes] Roll call of about 1/3 of the students (repeat another third at the next session). Angel for attendance. Questions?
-
[3 minutes] Review the chaos.py program.
-
[17 minutes] Review and practice: the input-compute-output pattern. Modules:
- m1_temperature.py (review)
- m2_distance_from_origin.py (practice)
- m5_logarithm.py (homework)
-
[20 minutes] Defining a function versus calling a function. Modules:
- m3_print_vs_return.py (demonstration, then practice)
- m6_sines_print_vs_return.py (homework)
-
[5 minutes] Check that zellegraphics is installed correctly. Fix if not. Choose robot partners for today.
-
[5 minutes] Break, fix zellegraphics if necessary, catch-up. Bring out the robots.
-
[25 minutes] Introduction of objects, using zellegraphics as the example. Modules:
- m4_face.py (demonstration, discuss)
- m7_picture.py (homework)
-
[15 minutes] The iRobot Create. Demo. Introduce its hardware. (Next session: programming them.)
-
[5 minutes] Explain how to find homework, how to do homework, when due, where to get help. Put robots back in cabinets. Questions?
Resources
-
Slides: Functions, Objects and Methods
-
Zellegraphics Library API: A Python module for doing cool graphics — simple graphics, but very easy to learn
HW Assigned
-
HW 2