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

CS 1110: Introduction to Computing Using Python

Fall 2012

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 16


Week 15

29 November (Thursday): Where to From Here?

[Presentation]

Hopefully you have enjoyed this course. Assuming that you have, today we discuss your options about what to do next in computer science.



Lab 12: Timing Performance

[Instructions]

This last lab is optional. With that said, it is an activity that will help you better understand the different sorting procedures that we covered in class (and which you will be responsible for on the final).


27 November (Tuesday): Statically-Typed Languages

[Handout]      [Presentation]
Demos
fraction.py
Fraction.java
anglicize.py
testanglicize.py
Anglicize.java
AnglicizeTester.java
Animal.java
Cat.java
Dog.java


Today's lecture is to help ease the transition a bit to 2110. We give you a brief introduction to the concept of statically typed languages, and discuss why they are so useful (but also so much harder to use).



Week 14

22 November (Thursday): THANKSGIVING





20 November (Tuesday): Stateful Controllers

[Handout]      [Presentation]
Demos
callback.py
button.py
animation.py
touch.py
touch.kv


It is obvious why models in the model-view-controller pattern should be defined by classes. Furthermore, views are always subclasses of a GUI library. But why does a controller have to be a class? We did not use classes to define the controller in A3. Today we answer this question. As part of the answer, we see that loop invariants and field invariants are the same idea.

Reading: Chapter 19



Week 13

15 November (Thursday): Catch Up



We have gotten a full lecture behind and will finish searching and sorting today. There are no new slides or Python modules for this class.



Lab 11: Loop Invariants

[Instructions]

The purpose of this lab is to give you practice with developing loops from invariants. It also introduces some of the important seqeunce algorithms that you should know for the final exam. On the final, you would be expected to write (a variation of) one of the following: binary search, Dutch National Flag, partition, selection sort, and insertion sort.


13 November (Tuesday): Searching and Sorting

[Handout]      [Presentation]
Demos
algorithms.py


Today we continue talking about invariants and sequences, and use this to implement several important algorithms (one of which will be on the final). This lecture will probably roll over to Thursday, but we are posting all of the notes for today and Thursday with this lecture.



Week 12

8 November (Thursday): Sequence Algorithms

[Handout]      [Presentation]
Demos
algorithms.py


Today we talk about how to create complex algorithms on sequences (strings, lists, and tuples). This lecture covers advanced loop-invariants, and is a very important lecture for the final exam. Do not skip this lecture.

Reading: Chapter 13



Lab 10: Loop Exercises

[Instructions]

The purpose of this lab is to give you some practice with loop assertions (preconditions, postconditions, and invariants) and with while loops that process a range of integers. It is a mixture of coding exercises and answers to be written on paper.


6 November (Tuesday): Loop Invariants

[Handout]      [Presentation]

Today we continue our discussion of while-loops. In particular, 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.

Reading: Loop Invariants



Week 11

1 November (Thursday): While Loops

[Handout]      [Presentation]
Demos
loops.py
flow.py


Today is a short lecture, as we need to catch up on the remainder of the previous lecture. 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 third of the course.

Reading: Chapter 7



Lab 9: Encapsulation and Data

[Instructions]

This lab gives you some experience with encapsulation and abstraction. It also contains a recursion problem, to give you some more practice for the upcoming exam. The concepts of this lab were, believe it or not, part of assignments A1 and A3 in previous semesters of this course.


30 October (Tuesday): OO Design

[Handout]      [Presentation]
Demos
temperature.py
bettertemperature.py
converter.zip


Today is a "big-picture" lecture that puts all of the details that we have learned so far into perspective. It shows why object-oriented programming is useful, and gives some hints about what you would learn in later courses. This is the last material that will be on the second prelim.

Reading: Model-View-Controller



Week 10

25 October (Thursday): Classes and Types

[Handout]      [Presentation]
Demos
fraction.py
fraction.py
trying.py
eq.py
Additional
Handling Exceptions
Exception Classes


Types are an important part of any programming language, even Python (despite what some internet blogs may say to the contrary). In this lecture we show how important types are in programming, and how classes provided a lot of important functionality regarding types.

Reading: Section 14.1-14.5



Lab 8: Sublasses

[Instructions]

This lab demonstrates the power of subclasses, particularly in GUI applications. Subclasses are a great way to customize visual behavior of a GUI object. In addition to basic subclasses, you this lab will also give you some experience with the use of the super function.


23 October (Tuesday): Inheritance

[Handout]      [Presentation]
Demos
app.py
employee.py


Today we talk about subclasses and inheritance: an important part of object oriented programming. This allows us to take classes that someone else created (such as the GUI classes that Kivy provides) and add functionality to them.

Reading: Chapter 18



Week 9

18 October (Thursday): Properties and Methods

[Handout]      [Presentation]
Demos
point.py
fraction.py
betterfraction.py
bestfraction.py


Today we show off some very advanced features about classes in Python. These features allow us to do things such as enforce invariants, or make objects that look and behave like the primitive types. Even the experienced Java programmers will learn something today.

Reading: Chapter 17



Lab 7: For-Loops and Classes

[Instructions]

The lab for this week is a bit of a hodge-podge, reflecting that we are in transition between topics (and the fact that there was no lab last week). It has a single problem on for-loops, which were introduced last week. It also asks you to make a simple class (which should look familiar).


16 October (Tuesday): Classes

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


Today we start the next major segment of the course. We finally learn what all of this "object-oriented" stuff is about. We have seen objects, but they are a bit mysterious and always required some special module in the background. Today we learn about classes, and how to write these special modules.

Reading: Chapters 15, 16



Week 8

11 October (Thursday): For-Loops and Dictionaries

[Handout]      [Presentation]
Demos
loops.py
grades.py
drawturtle.py
cturtle.py
colormodel.py


Coming back from Fall Break, we will learn about for-loops, which is an alternative to recursion that works in some applications. In addition, we will talk about dictionaries, which are another type for storing collections of data.

Reading: Sections 8.4, 8.7; Chapters 10, 11



9 October (Tuesday): FALL BREAK



There is no class today.



Week 7

4 October (Thursday): Catch-Up Lecture

Demos
names.py
globals.py
swap.py
list2d.py
length.py
deblank.py


We have been about a half a lecture behind for a while today. Instead of introducing new material (we have moved for-loops to after Fall Break), we will simply finish recursion. We will also play with the Python visualizer that we announced on Piazza.



Lab 6: Recursion Exercises

[Instructions]

This lab gives you experience with writing recursive functions. All of the functions in this lab are either be recursive functions on sequences, or recursive functions on integers, just as we saw in class. This is a very long lab, but you have until a week after Fall Break to finish it.


2 October (Tuesday): More on Recursion

[Handout]      [Presentation]
Demos
more_recursion.py
string_recursion.py
test_more_recursion.py
test_string_recursion.py
cunittest.py


Today we continue talking about recursion, with several examples. We look at the different ways that we can break up a recursive method. We also introduce some of the ideas that will be used in Assignment A4 after Fall Break.

Reading: Sections 6.5-6.8



Week 6

27 September (Thursday): Recursion

[Handout]      [Presentation]
Demos
math_recursion.py
string_recursion.py
test_math_recursion.py
test_string_recursion.py
cunittest.py


Today we talk about recursion, a powerful computing tool and one of the harder concepts in the course. Recursion is one of the foundamental principles of computer science, and used for a lot of advanced algorithms. We will see many applications as the course progresses.

Reading: Section 5.8-5.10



Lab 5: Lists and Asserts

[Instructions]

This is another short lab to introduce you to the list type. Lists are similar to strings, except they are mutable. In addition, we have a very short exercise on asserts and try-except.


25 September (Tuesday): Lists (and Sequences)

[Handout]      [Presentation]

Today we cover the general topic of sequences, and more specifically lists. Sequences are a category that includes both strings and lists; sequences can be sliced up in the way that strings can. Lists, however, are different in that they are mutable. We will see why this is important.

This is the last new material for the first prelim.

Reading: Sections 10.0-10.2 and 10.4-10.6



Week 5

20 September (Thursday): Call Stacks

[Handout]      [Presentation]
Demos
globals.py
error.py
asserts.py
try.py
recover.py


Today we return to the notion of the call frame. We put it in the context of the bigger "call stack", which is the collection of frames for all currently executing functions. We also show how this is relevant to error detection in your program.

Reading: Sections 3.9-3.10



Lab 4: Strings and Conditionals

[Instructions]

This is a short lab to make up for all of the other work you have. This lab builds upon the skills you developed in the first assignment, and gives you experience writing more complex functions involving conditionals. If you finish early, you may use the lab time to get help from the consultants on anything else in the class.


18 September (Tuesday): Algorithm Design

[Handout]      [Presentation]
Demos
reorder.py
anglicize.py
testanglicize.py
cunittest.py


The first assignment was very much do-this/do-that. Today we step back and see how we would design a complex program from scratch. How do we take a complex task and break it up into manageable pieces?

Reading: Chapter 4



Week 4

13 September (Thursday): Conditionals and Control Flow

[Handout]      [Presentation]
Demos
flow.py
point.py
Additional
Function Frames


Today we talk about the difference between program structure and program flow. We also introduce the condition, which is our first program structure for controlling flow. This will not be necessary for Assignment 1, but will be a major part of Assignment 3.

Reading: Sections 5.1-5.7



Lab 3: Functions and Testing

[Instructions]

This lab is longer than the previous ones. This is an intensive, hands-on lab to give you a lot of experience with testing and debugging. It is absolutely important that you complete this lab before you finish the first assignment; you will need these skills for that assignment.


11 September (Tuesday): Specifications and Testing

[Handout]      [Presentation]
Demos
greet.py
temperature.py
bettertemp.py
cunittest.py
name.py
testname.py
debug_name.py


Today we learn how to test functions and make sure that they are working properly. This is an important lecture, and the last one that you will need to work on assignment 1.

Reading: Docstrings in Python



Week 3

6 September (Thursday): User-Defined Functions

[Handout]      [Presentation]
Demos
greet.py
temperature.py


Today we show how to define our own functions and to do interesting things with modules. In many ways, this is our first day writing actual programs. You will need Komodo Edit working properly to use what you learn today.

Reading: Sections 3.5-3.13 and 6.1-6.4



Lab 2: Using Object APIs

[Instructions]

The purpose of this lab is to get you comfortable with using the Python functions and modules. Python has a lot of built-in modules, which collectively are called the Python library.


4 September (Tuesday): Strings and Objects

[Handout]      [Presentation]
Demos
point.py


Today we talk about two complex data types: strings and objects. For strings, we look at string slicing, and see how to extract a substring, or even individual characters from a string. Objects are a more general data type. To understand them, we introduce the folder metaphor which we will use throughout this course.

Reading: Chapter 8 (not 8.6, 8.11)



Week 2

30 August (Thursday): Modules and Functions

[Handout]      [Presentation]
Demos
module.py
hello.py
data.py
badpi.py


Today we move away from the interactive shell to using a text editor to write Python code. We see how we can use it to write much more complex programs. As the code becomes more complex, we need to break it up into little building blocks, which we call functions.

Reading: Sections 3.1-3.4



Lab 1: Evaluating Expressions

[Instructions]

The purpose of this lab is two fold. First, it is designed to get you started with Python immediately. Second, gives you hands on experience with Java expressions, which we talked about on the first day of class.


28 August (Tuesday): Variables and Assignments

[Handout]      [Presentation]

We got caught up in covering the course expectations last time, so this class we start for real with our discussion of Python. 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.
expressions and types. We will use the iClickers for the first time today.

Reading: Sections 2.2-2.9



Week 1

23 August (Thursday): Types and Expressions

[Handout]      [Presentation]
Additional
Course Overview
Learning Styles


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

Reading: Chapter 1; Section 2.1