Lecture Slides
The slides from lecture are provided as .pdf files,
convenient for printing.
Some of them are accompanied by the example Python programs we
write in class.
To put the example Python programs onto your computer
(at least in Windows), right-click on the link for the program
and select "Save target as.." or "Save as..".
-
Fri 9/26 slides. Read pages 1-11 in the textbook.
-
Mon 9/29 slides. Data: integers, floating point numbers, and strings. Read pages 28-35 in the textbook.
-
Wds 10/1 slides. Variables, concatenating strings, getting user input.
No additional reading.
-
Fri 10/3 slides. If,elif,else. Read pages 52-64.
-
Mon 10/6 slides. Boolean expressions, converting types. Read pages 77-81.
-
Wds 10/8 slides. While statement, converting types. Read pages 65-68.
bmi.py Body mass index program. Note: crazy input will crash this program.
-
Fri 10/10 slides. Compound interest. Read pages 66-71.
eir.py Computing an effective interest rate using
a while loop.
-
Mon 10/13 slides. Importing a module to extend
Python. Output formatting string. Read pages 52-55 for a different example of
importing a module.
eirVersion2.py Effective interest rate with fancier
input and output. You'll also need the helper.py file, in the same folder as eirVerstion2.py, to get it to run.
-
Wds 10/15 slides. Sentry variables are discssed
on pages 66-68. Lists are introduced on pages 122-123, but don't feel compelled
to read up to there.
rps.py Rock, paper, scissors game. Using the
random module, some sentry variables, and a list.
-
Fri 10/17 slides. Review for midterm.
-
Mon 10/20 - Midterm.
-
Wds 10/22 slides. Lists, strings, the len function, for loops. We're starting Chapter 4 now. Read pages 90-97 and 123-127.
-
Fri 10/24 slides. New! Slides updated with new info on the in operator. The range function, and and the split method, and pages 37-40 on string methods, and the in operator.
-
Mon 10/27 slides. More
string methods:
find and replace. Reading files.
sentences.py Reads the text in the file
article.txt, and breaks it up into sentences.
Uses a list of words. Notice that the population of Iceland is smaller than
the population of Sacramento.
-
Wds 10/29 slides Answering queries from data in a file.
-
Fri 10/31 slides
Intro to foreclosure map assignment, and dictionarys. We are now doing the
last half of Chapter 5, starting at page 140.
repDict.py also reads CAreps.txt, and lets the user look up what district a Representative serves,
using a dictionary.
-
Mon 11/3 slides. More on dictionaries, and the in
operator in different contexts.
-
Wds 11/5 slides. Computer organization, how lists and dictionaries work. This material is not in the book.
-
Fri 11/7 slides. Writing files (pages 201-204), the .tsv file format, and special requirements for Many Eyes.
Also, the value None (page 108), and formatting strings for output.
censusMap.py, reads census.txt, and writes out a .tsv file that can be visualized in Many Eyes, showing the
percentage Hispanic population in California counties.
-
Mon 11/10 slides. Exceptions (pages 209-214). Don't worry too much about different kinds of exceptions. Also, the strip method for strings.
-
Wds 11/12 slides. Introduction to functions. Will not be on Midterm 2. Pages 163-173.
-
Fri 11/14 slides. Midterm review.
-
Wds 11/19 slides. Introduction to PIL.
Here is the PIL documentation. We will only use the
Image module.
To use PIL, we need to understand tuples, pages 110-117.
-
Fri 11/21 slides.
Image processing assignment, functions, and the Image module.
pastel.py, display an image with the colors
all made paler.
-
Mon 11/24 slides.
Double for loop, local and global variables.
-
Mon 12/1 slides.
Counting by tens, and suggestions for how to pixelate the image.
-
Wds 12/3 slides.
A quick overview of object-oriented programming in Python.
circleClass.py makes a class of circles,
that can draw themselves onto an image.
-
Fri 12/5 slides.
Reviewing for final.