Assignments
In addition to assignments, this section includes an introductory handout on Python and IDLE (see session 1) and a sample exam students could take at the end of the course (see sessions 9-10).
SES # | TOPICS | DESCRIPTIONS | ASSIGNMENTS | SUPPORTING FILES |
---|---|---|---|---|
1 | Variables and operators | Day 1 covered variables and their manipulation through operators. | (PDF) | Getting Started: Python and IDLE (PDF) |
2 | Conditionals and iteration | Day 2 covered control flow with if-elif-else statements, while loops and for loops. | (PDF) | |
3 | Functions | Day 3 covered how to define and use functions. | (PDF) | |
4 | Control flow with while | Day 4 covered strings, lists, and environment diagrams, as well as (optionally) list comprehensions. | (PDF) | |
5 | Project 1: structuring larger programs |
For this project, download hangman_template.py; rename it to hangman.py. Also download words.txt and save it in the same directory. For the optional part you'll need hangman_lib.py; save it in the same directory. An example of how to use this file is found in hangman_lib_demo.py. | (PDF) |
hangman_template.py (PY) words.txt (TXT) hangman_lib.py (PY) hangman_lib_demo.py (PY) |
6 | Review, dictionaries |
Day 6 covered some review problems, and went over dictionaries. Code you'll need: names_ages.py and inventory.py | (PDF) |
names_ages.py (PY) inventory.py (PY) |
7 | Introduction to objects |
Save graphics.py in the directory where you do your work. Open it in IDLE and run it; you should see graphics_result.png pop up. When you close the pop-up, some errors will display in the interpreter; you can ignore these. You'll also need the documentation for the graphics module; rgb.txt, a list of all colors Python recognizes; and wheel.py (for exercise 7.3). | (PDF) |
graphics.py (PY) Graphics documentation (PDF) (The graphics.py package and documentation are courtesy of John Zelle, and are used with permission.) graphics_result.png (PNG) rgb.txt (TXT) wheel.py (PY) |
8 | Objects and inheritance | Day 8 covered objects and inheritance. | (PDF) | |
9-10 | Project 2: working in a team | For this project, download tetris_template.py and save it in the same directory that you saved graphics.py in. Please edit this file, and place your code in the sections that say "YOUR CODE HERE". | (PDF) |
tetris_template.py (PY) Sample exam (PDF) |