CS106L Introduction to Computing and Programming in Python (Lab)

Fall 2008

Midterm Solution

midterm_solution.py


Course Instructor Dr. Barrett Bryant (bryant@cis.uab.edu)
Lab Instructor David O'Gwynn ( cs106ta@cis.uab.edu)
Office Hours: Thurs. 11am-3pm, CH 154
(You are not to be in CH154 unless I am there.)
Lab Session Thu 3:30pm-5:20pm CH 430
Lab Materials
  • Course Textbook required for all Labs.
  • CIS account
Links
Course: http://www.cis.uab.edu/cs106/
Lab: http://www.cis.uab.edu/cs106/fall2008-lab/
Python: http://www.python.org/
JES: http://coweb.cc.gatech.edu/mediaComp-plan/MediacompSoftware
Lab Conduct
  1. Students are expected to conduct themselves in a professional manner.
  2. Laptops will be allowed only for the purpose of the class.
  3. During a lecture, students may not log into a machine and do work that is not directly related to the topic of the current lecture.
  4. Students must turn their cell phones/pagers OFF during the class.
E-mail Every student will be required to use his/her official email address (that is, blazerid@uab.edu). New students must login and configure their email addresses. For more details on obtaining a blazerid and configuring email, please see: http://www.uab.edu/blazerid. All email communications will be made using this address. Additional instructions or announcements will be sent by e-mail, so check your mail often - at least twice a day (once in the morning and once at night). Also, check the course webpage for up-to-date information and announcements. The instructor will check email frequently; e-mail is often the best way to contact the instructor.
Academic Honesty Students who plagiarize a computer program (or parts of a program), get others to write a program (or parts of a program), or are found cheating on an exam, will be reported for academic dishonesty. Anyone who is caught cheating will receive a 0 on a given test or assignment. If a second offense occurs, the student will receive an F in the class. This includes both the provider of the information as well as the receiver of the information. Any student who violates the university's academic honesty policy will be reported for academic discipline. All university and department policies related to students are included here by implication.

Labs

DateLab NumberDescription
Aug 21 Lab 1
  • Lab Introduction
  • CIS account application
  • What is digital media?
  • Installing Python and JES
  • Introduction to Python and JES:
    • expressions
    • numbers, integers, floats, strings
    • Calling functions
      • arguments
      • files
28 Lab 2
  • Lists, indexing
  • for loops
  • Designing functions
Sep 4 Lab 3
  • Review of last half of Chapter 3
  • range function
  • Integrating range function with pixel operations
11 Lab 4
  • Starting Chapter 4
  • Using range to modify pixels in a subsection of an image
  • if statements
  • Using the MediaTools to get pixel information
    • setMediaPath
    • getMediaPath
    • MediaTools --> Picture Tool...
  • Using the range function to modify pixels
25 Lab 6
  • Blending
  • Subtraction
  • Drawing Text and Geometry
Oct 2 Lab 7
  • Review of homework problems
Oct 16 Lab 8
  • Sounds
Oct 23 Lab 9
  • Sounds
Oct 30 Lab 10
  • Sounds
Nov 6 Lab 11
  • Text
  • Lists
Nov 13 Lab 12
  • urllib
  • Form documents