Session Details
Week 3,
Session 8 — Thu Dec 16
Prep
-
Sections 5.6-5.10
20 pages
-
4.1-4.9
(36 pages, BUT much of Chapter 4 has details that you should just skim,
-
returning to the text for reference when you need those details.
-
For example, all of Section 4.8 is in this category — just skim that section briefly and return to it as needed for reference.)
-
Note that our
zellegraphics package replaces the author's graphics package.
HW Due
-
HW 7
Topics
-
Using a Debugger
-
Introduction to Objects and object-based programming
-
Graphics
-
Animation
Outline
-
[5 minutes] Take attendance, hand out quiz, open today's project. Questions?
-
[10 minutes] Tips for using Eclipse effectively:
- Control-space for auto-completion. Use descriptive variable names!
- Source ~ Format Code (Control-Shift-F) to format your code. Do it!
- Understanding syntax error messages (and then fixing them)
- Understanding run-time error messages (and then fixing them)
-
[10 minutes] Introduction to Sequences
- What is a sequence? How to reference its items with the square-bracket notation.
- Indices start at 0.
- The len function.
- What happens if you attempt to access with a too-large or negative index.
- Module m1_using_indices_in_sequences.
- Types of sequences in Python.
- Lists, tuples, strings, bytes, byte arrays, ranges. Others.
- What they have in common and how they differ.
- Module m2_types_of_sequences.
-
[25 minutes] Looping through a sequence (review from last session)
- Directly, without using a range expression
- Using indices generated by a range expression
- Variation: referring to other indices during the loop
- Modules m3_looping_through_sequences and m5_practice_looping_through_sequences
-
[5 minutes] Break
-
[25 minutes] Accumulating sequences
- With the + operator
- With append (for lists) or join (for strings)
- Modules m4_acccumulating_sequences and m6_practice_accumulating_sequences
-
[20 minutes] Robots: wander and kit-lights
-
[5 minutes] Show homework
Resources
-
Slides: Sequences — Lists, Strings, Tuples
HW Assigned
-
HW 8