T-Th 9:05
or
T-Th 11:15
in Olin 155

CS 1110: Introduction to Computing Using Python

Spring 2017

Lecture Summaries

This page lists a summary of the activities of each week, in reverse chronological order. This is your go-to page for downloading in-class handouts and getting caught back up if you get behind. This page is updated dynamically all semester long, with new material added as we get there.

If you want to see what future lectures in this class will be, you should look at the syllabus page.


Week 15

Lab 14: Drop-in office hours and lab 13 checkoff

Like the title says.


9 May (Tuesday): No lecture - optional drop-in office hours



Prof. Lee will be having optional drop-in office hours in the usual lecture room. Prof. Andersen will be out of town.



Week 14

4 May (Thursday): An Extended Example That Reviews Much of CS1110

[Presentation]
Demos
fraction.py
refraction.py


Professor Andersen tries to re-engineer the Refraction core game mechanics live.



Lab 13: Loops and Loop Invariants

[Instructions]

This is the last lab assignment of the course.

The material will be covered on the final exam; the problems assigned are ones that students might greatly benefit from in-person feedback on; and the lab is being released during a gap in assignments. Therefore, we strongly encourage students to start this lab early and get it checked during May 2-3 labs, even though the deadline isn't until May 9-10.


2 May (Tuesday): Sorting and Searching

[Handout]      [Presentation]
Demos
algorithms.py
superstuff.py


Today we continue our discussion of invariants and algorithms from the previous lecture. We review the Dutch National Flag algorithm and talk about how changing invariants can change your algorithm.



Week 13

27 April (Thursday): Sequence Algorithms

[Handout]      [Presentation]

Instead, today we start on the last major topic in the course: sorting. Before we get to sorting, we have start with the framework for building complex algorithms on sequences (strings, lists, etc.). This lecture covers advanced loop-invariants, and is a very important lecture for the final exam.

Reading: Chapter 13



Lab 12: There is no lab 12! (prelim)

No new lab will be assigned for the Tues Apr 25/Wed Apr 26 dates because of the prelim.
The Tuesday lab times and locations will be staffed and will serve as open office hours for anybody to drop in on, regardless of registered section. In contrast, for the Wednesday lab times and places, no staff members will be there.


25 April (Tuesday): NO CLASS - DROP-IN OFFICE HOURS



Held in the usual lecture hall.



Week 12

20 April (Thursday): Prelim 2 Review Session



Materials:



Lab 11: Subclasses, or, Cripple Mr. Onion

[Instructions]

The printed handout has a few errors in it, which are corrected in the orange text of the online version of the handout.
Because of the prelim, this lab is not due until the first ten minutes of the labs of Tue May 2/Wed May 3. But don't delay on it, since it will help with the prelim!


18 April (Tuesday): Loop Invariants

[Handout]      [Presentation]

Today we discuss how to design algorithms for while-loops. We introduce the notion of a loop-invariant, and show how to use that to write a program with a loop. Invariants are an important topic on the final exam, and are covered in the final labs.

Reading: Loop Invariants



Week 11

13 April (Thursday): While Loops

[Handout]      [Presentation]
Demos
fraction.py


Today we introduce while-loops, which are an alternate form of iteration. They are trickier to use than for-loops, and will be an important part of the last part of the course.

Reading: Chapter 18



Lab 10: Blackjack

[Instructions]

This lab gives you some experience working with classes. And when you are done, you can play a nice game of blackjack.


11 April (Tuesday): Subclasses and Inheritance

[Handout]      [Presentation]

There is a lot going on with classes in Python. There are all these mysterious methods that start with an underscore. Today we talk these mysterious methods. We show how to use these methods to create classes for mathematical types like fractions or complex numbers.

Reading: Chapter 17



Week 11

6 April (Thursday): SPRING BREAK



There is no class today.



4 April (Tuesday): SPRING BREAK



There is no class today.



Week 10

30 March (Thursday): Using Classes Effectively

[Handout]      [Presentation]

In previous lectures, we have learned the syntax for defining classes. Today we look at the design philosophy for making classes. This lecture is very similar to Lecture 9 (Algorithm Design), except that it is for classes instead of functions.



Lab 9: Recursion

[Instructions]

Due Tue Apr 11 or Wed Apr 12 because of Spring Break. Do read the handout; but since it's short and you don't have to write on it, we will not be printing it out.


28 March (Tuesday): Classes

[Presentation]
Demos
example.py
flower.py
point.py
worker.py


Up until now, if we wanted to use objects, we had to import a module that provided them for us. Today we finally learn how to create our own classes. Not only can we make our own class types now, but we can even add them to the Python visualizer.

Reading: Chapters 15, 16



Week 9

23 March (Thursday): More on recursion

[Presentation]
Demos
reverse.py
palindrome.py
person.py
testperson.py




Lab 8: For-loops with lists, possibly nested

[Instructions]

Zip files updated Thursday 3/16 at 1:14pm to fix module naming issue We are releasing this lab early because the first part could be useful as extra for-loops practice with the deferred prelim. But the prelim was written before this lab was created, so the exam doesn't depend on any material introduced in this lab.

We will not be printing the handout, since it contains very little information not already contained in the files themselves.


21 March (Tuesday): Recursion

[Presentation]
Demos
towers.py
hanoi.py


Today we talk about recursion.



Week 8

16 March (Thursday): Nested Lists and Dictionaries

[Presentation]
Demos
data.py
grades.py
transpose.py


Today we talk about how lists can be used inside of other lists to create two-dimensional tables. We will also talk about dictionaries.

Reading: Chapter 11, inc. sections 11.1-11.2; 11.4



Lab 7: There is no lab 7! (prelim)

No new lab will be assigned for the Tues Mar 14/Wed Mar 15 dates because of the prelim.
The Tuesday lab times and locations will be staffed and will serve as open office hours for anybody to drop in on, regardless of registered section. In contrast, for the Wednesday lab times and places, no staff members will be there.


14 March (Tuesday): NO CLASS - open office hours



No regular class. open office hours during lecture time instead.



Week 7

9 March (Thursday): Optional Review Session

[Presentation]



Lab 6: Lists and Objects: Cards and Poker Hands

[Instructions]

Because of the prelim, this lab is not due until the first ten minutes of the labs of Tue Mar 21/Wed Mar 22. But don't delay on it, since it will help with the prelim!
 
Practice with list operations, and doing some coding with lists of objects, in this case, Cards.


7 March (Tuesday): Iteration and For-Loops

[Handout]      [Presentation]

Lists (and sequences) come with their own special control structure: the for-loop. In this lecture we see what for-loops can (and cannot) do to make more interesting programs.

Reading: Sections 4.2, 10.3



Week 6

2 March (Thursday): Lists (and Sequences)

[Handout]      [Presentation]

Reading: Sections 10.0-10.2; 10.4-10.7; 10.10-10.13



Lab 5: Objects; Conditionals; Oink!

[Instructions]

Practice with creating objects and simple manipulation of attributes and variables associated with objects. Practice with conditionals, including with more sophisticated string manipulation: Pig Latin.


28 February (Tuesday): Memory in Python

[Handout]      [Presentation]
Demos
error.py
recover.py


Throughout the past few weeks, we have seen several different ways of representing memory in Python. Today we put everything together, introducing global space, heap space, and the call stack. The latter is the collection of frames for all currently executing functions.



Week 5

23 February (Thursday): Conditionals and Control Flow

[Handout]      [Presentation]
Demos
flower.py


Today we talk about the difference between program structure and program flow. We also introduce the conditional, which is our first program structure for controlling program flow. This will not be necessary for Assignment 1, but will be very important in later assignments.

Reading: Sections 5.1-5.7



Lab 4: There is no lab 4! (February break)

No new lab will be assigned for the Tues Feb 21/Wed Feb 22 date because of break.
The Wednesday lab times and locations will be staffed and will serve as open office hours for anybody to drop in on, regardless of registered section. In contrast, for the Tuesday lab times and places, no staff members will be there (we will be on break, instead.)


21 February (Tuesday): FEBRUARY BREAK



There is no class today.



Week 4

16 February (Thursday): Objects

[Handout]      [Presentation]
Demos
geom.py


Today, we introduce the notion of objects. Objects are a new type of data. They require a new conceptual model for us to understand them.

Reading: Sections 15.1-15.2; 15.4-15.7



Lab 3: Strings; Testing

[Instructions]

Because of February break, this lab is not due until the first ten minutes of the labs of Tue Feb 28/Mar 1. But don't delay on doing lab 3, since it will help with assignment 1.


14 February (Tuesday): Specifications and Testing

[Handout]      [Presentation]
Demos
cornelltest.py
test.py
test2.py
name.py


We now know how to write some complex functions. However, writing functions takes a lot of practice and you are likely make mistakes along the way. That is why it is extremely important to test your functions and make sure they are working properly. As part of testing, we will also see why comments are more important than just notes to yourself.



Week 3

9 February (Thursday): Strings

[Handout]      [Presentation]

Python really shows off its power when working with text. Today we go into depth about the string type, which is how Python represents text. We show how to cut up text and paste it back together. The techniques that we learn will be very important for the first assignment.

Reading: Chapter 8.1, 8.2, 8.4, 8.5, 8.8, first paragraph of 8.9



Lab 2: Functions and (in) Modules --- Some "Hi"-lights

[Instructions]

Learning goals: Practice with: (1) the Command Shell; (2) using and editing functions defined in an external file; (3) Komodo Edit; (4) running Python scripts on the command line; (5) using one function as a helper for another.


7 February (Tuesday): Defining Functions

[Handout]      [Presentation]
Demos
temperature.py
scope_example.py
increment.py
variables.py


Now that we know how to use functions, we can learn how to create our own functions. As part of this, we will learn the important difference between a function call and a function definition.

Reading: Chapter 3



Week 2

2 February (Thursday): Functions and Modules

[Handout]      [Presentation]
Demos
module.py
script.py


Today we introduce the concept of a module and show how they provide Python with extra (optional) functionality. We show how to use the many modules built into Python, and how to make our own modules.

Reading: Sections 3.1-3.4



Lab 1: Expressions and Assignments

[Instructions]

Learning goals: (1) get hands-on experience using Python in interactive mode via the command shell; (2) get hands-on experience with Python types, expressions, and variables.


31 January (Tuesday): Variables and Assignments

[Handout]      [Presentation]

While we got started with a little bit of Python last time, this time we will jump into it. We show how to use Python as a calculator, and introduce the notion of expressions and types. We also introduce the notion of a variable, and how an assignment statement works.
We will use the iClickers for the first time today.

Reading: Sections 2.2-2.9



Week 1

26 January (Thursday): Types and Expressions

[Handout]      [Presentation]

In this class we give an overview of the course and its expectations. We show you how to get started with Python. In particular, we introduce types and expressions, which is the bare minimum that you need to do something "useful" in Python.

Reading: for next time, Chapters 1 and 2



Course Material Authors: E. Andersen, D. Gries, L. Lee, S. Marschner, C. Van Loan, & W. White