LEC # | TOPICS | HANDOUTS AND EXAMPLES |
1 | Introduction |
raw_input_example.py ( PY)
|
2 | Conditionals, loops |
How to comment code properly ( PDF)
conditional_examples.py ( PY)
|
3 | Defining functions |
|
4 | Strings, lists, list comprehensions |
comprehension_examples.py ( PY)
Additional Material
Two examples of a rock-paper-scissors program:
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):
|
Optional lecture | Recursion |
Solutions to optional problems ( PY)
|
5 | Tuples, dictionaries, common Python mistakes |
Remember that the keys of a dictionary must be immutable objects, but thevalues 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) |
2. Built-in Functions
The Python interpreter has a number of functions and types built into it that are always available. They are listed here in alphabetical order.