Lectures

LEC # TOPICS HANDOUTS AND EXAMPLES
1 Introduction

Getting started (PDF)

raw_input_example.py (PY)

2 Conditionals, loops

How to comment code properly (PDF)

height_example.py (PY)

conditional_examples.py (PY)

loop_examples.py (PY)

3 Defining functions

lecture3.py (PY)

functions.py (PY)

check_for_vowels.py (PY)

4 Strings, lists, list comprehensions

string_examples.py (PY)

list_examples.py (PY)

comprehension_examples.py (PY)

Additional Material

Two examples of a rock-paper-scissors program:

rps_example1.py (PY)

rps_example2.py (PY)

How to use while-else loops (suggestion: don't use them at all, but if you do be aware they work differently than you might think):

while_else.py (PY)

5 Tuples, dictionaries, common Python mistakes

tuple_examples.py (PY)

Remember that the keys of a dictionary must be immutable objects, but the values of a dictionary can be either immutable or mutable objects.

Common Python mistakes and misconceptions (PDF)

6 Classes point.py (PY)
7 More about classes wheel.py (PY)
8 Inheritance inheritance_examples.py (PY)

Optional Lectures

Recursion

Recursion notes (PDF) and examples (PY)

Optional recursion problems (PDF) and solutions (PY)

Local/Global Variables (Scoping)

If you are interested in learning more about scoping, try reading chapter 3 of the 6.01 course notes (start at section 3.2.2, page 42).

Also, here's a good blog post: Notes on Python variable scope