CMPT 140 Fall 2010 Extra HW/Lab Assignments

Most homework and lab assignments are taken from the Python or M2 textbooks. This page lists amendments and assignments not taken from the textbooks.

Lab 0: Python/IDLE Intro (due Thu 16Sep)

The point of this "Lab 0" is to ensure you have a working development environment for Python and have familiarity with creating Python (.py) files and executing them. There is nothing to turn in for this lab, but you need to make sure you have completed it on time so that you can move on to the first "real" lab, Lab 1.
  1. Fire up Python!
  2. Walk through all the examples in the textbook, sections 1.6-1.7 (it's not much!). In particular, make sure you understand how to create a Python program (in this example, chaos.py), save it, open it, and run it in IDLE.
  3. That's it! Get ready for Lab 1, the first "real" lab you have to turn in.

Lab 1: Interactive Programs in Python (due Thu 23Sep)

This is your first lab for which you need to turn something in. Make sure you have completed Lab 0 before starting on this. The options for this assignment are in the Modula-2 supplemental textbook, available online: see M2 ch2 §14. Choose one of the following, but implement it in Python instead of Modula-2: You must also write a short lab write-up to go with your Python program; see the template lab write-up and rubric of how write-ups are marked. For this first lab, a simplified write-up is sufficient: you may include just the sections titled, "Problem", "Problem Suitability", "Problem Restatement", and output from a few sample runs of your program. The point breakdown is listed at the very end of the lab write-up rubric page, under "simplified write-up". Upload both your program (.py file) and your writeup (.doc, .odt, .html, .pdf, etc. -- as long as your TA can read it) to myCourses before 10pm on the due date. You will want to get started early on this!

Lab 2: Control Structures (due Thu 30 Sep)

From M2 ch3 §14, choose one of the following, implementing it in Python: Again for this lab, a simplified write-up is all that's required. But be prepared, starting from Lab3, all labs must have a complete write-up with something in every section of the write-up template! Upload both your program (.py file) and your writeup (.doc, .odt, .html, .pdf, etc. -- as long as your TA can read it) to myCourses before 10pm on the due date.

Lab 3: Functions (due Thu 14 Oct)

From M2 ch4 §11, choose one of the following, implementing it in Python: Starting from this lab an onward, every lab must have a full lab write-up, following the format in the template lab write-up. You should have something in every section of the template! Be sure to include output from a few sample runs of your working program, and try to choose tricky test cases to see how your program behaves with weird input.

Lab 4: Drawing (due Thu 28 Oct)

The objective of this lab is to gain practice in using Zelle's graphics.py library to draw basic graphics. Choose one of the following from the Python textbook ch4 Programming Exercises:

Lab 5: Lists and File I/O (due Wed 10 Nov)

For this lab, you will be building complex data structures like Python lists and also using file I/O to read or save results to file. Choose one of the following options:

Lab 6: Object-oriented Class (due Thu 2 Dec)

Define an appropriate class and use it to solve one of the following problems from the Python textbook ch12 Programming Exercises: