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

CS 1110: Introduction to Computing Using Python

Fall 2013

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 17


Week 16


Week 15

5 December (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: Sequence Algorithms

[Instructions]

While this lab is technically held the last week of class (which would normally make it difficult to turn in the next week), this lab is important enough that we are not making it optional. It covers the major topics with sequence algorithms that will appear on the final. Therefore, you should complete the lab as a way of studying for the final exam. This lab is due before the day of the exam. See the lab instructions for how to turn in this lab.


3 December (Tuesday): Sorting

[Handout]      [Presentation]
Demos
algorithms.py


Today we complete our discussion of loop invariants and show how to use them to implement sorting. We also review the important algorithms that you should know for the exam. These include binary search, Dutch National Flag, partition, selection sort, and insertion sort.



Week 14

28 November (Thursday): THANKSGIVING



There is no class today.



26 November (Tuesday): Sequence Algorithms (cont.)

[Handout]      [Presentation]
Demos
algorithms.py


Today we complete the lecture we started last Thursday. There are no new slides or handouts for this lecture.



Week 13

21 November (Thursday): Sequence Algorithms

[Handout]      [Presentation]
Demos
algorithms.py


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 11: Loops and Invariants

[Instructions]
Files
lab11.py


This lab integrates what we have learned about invariants with while-loops. It is just like the last one, except that now you are using invariants to design your loops. This lab is due before you leave for Thanksgiving Break. See the lab instructions for how to turn in this lab.


19 November (Tuesday): Controllers and OO Design

[Handout]      [Presentation]
Demos
game2d.py
animation.py
touch.py
state.py
pyro.py


Today we return to classes one last time, and show how classes and while-loops fit together. By the end of the lecture, we will see that class invariants and loop invariants are really the same thing in practice. Today's lecture will provide you all that you need to know to get started on the last assignment.

Reading: Model-View-Controller for Noobs



Week 12

14 November (Thursday): Loop Invariants

[Handout]      [Presentation]
Demos
pairs.py


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 next two labs.

Reading: Loop Invariants



Lab 10: While-Loops

[Instructions]
Files
lab10.py
test_lab10.py
lab10.zip


This is the first of three labs involving loops. It includes both for loops over ranges integers and over more complicated conditions. Given both the exam and the assignment, we have tried to make this lab reasonable.



12 November (Tuesday): While Loops

[Handout]      [Presentation]
Demos
flow.py
comparison.py
numerical.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 third of the course.

Reading: Chapter 7



Week 11

7 November (Thursday): Classes as Types

[Handout]      [Presentation]
Demos
fraction.py
newfraction.py
read.py
trying.py


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 types affect the outcome of certain commands and operations.

Reading: Errors and Exceptions



Lab 9: Properties and Subclasses

[Instructions]
Files
drawapp.py
shapes.py
lab09.py
lab09.zip


This is a short(ish), but fun, lab that gives you experience with subclasses. In particular, you can see how subclasses can be very useful in graphics applications. We have also added an exercise with properties, as students often find those confusing.





5 November (Tuesday): Subclasses and Inheritance

[Handout]      [Presentation]
Demos
app.py
employee.py
employee2.py
resolve.py
initialize.py
override.py


Subclasses and inheritance are integral part of object oriented programming. It allows us to take classes that someone else created (such as the GUI classes that Kivy provides) and add functionality to them. Today we show how these features are used in Python.

Reading: Chapter 18



Week 10

31 October (Thursday): Advanced Class Design

[Handout]      [Presentation]
Demos
point.py
fraction.py
betterfraction.py
bestfraction.py
Additional
Python Special Methods


Now that we know how to design classes, it is time dig deep into Python. Python has some extremely powerful features that allow use to customize our classes in particular ways. In particular, we will see Operator Overloading, which allows us to change how operators like +, *, and == work. We will also see properties, which is a special way to enforce class invariants.

Reading: Chapter 18



Lab 8: Blackjack

[Instructions]
Files
blackjack.py
test_blackjack.py
card.py
lab08.zip


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





29 October (Tuesday): Using Classes Effectively

[Handout]      [Presentation]
Demos
time.py
rectangle.py
card.py
hand.py


Walker White is away at a conference today. Your lecture is presented by Steve Marschner, one of the instructors from the Spring semester version of CS 1110.

Last lecture we saw how the syntax for define classes. Today we look at the design philosophy for constructing classes. This lecture is very similar to Lecture 8 (Algorithm Design), except that it is for classes instead of functions.

Reading: Chapter 17



Week 9

24 October (Thursday): Classes

[Handout]      [Presentation]
Demos
example.py
example2.py
point.py
worker.py
person.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



Lab 7: Recursion Exercises

[Instructions]
Files
lab07.py
test_lab07.py
lab07.zip


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.


22 October (Tuesday): More on Recursion

[Handout]      [Presentation]
Demos
stringfun.py
morefun.py
person.py
test_stringfun.py
test_morefun.py
test_person.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 look at how recursion is used in Assignment 4.

Reading: Sections 6.5-6.8



Week 8

17 October (Thursday): Recursion

[Handout]      [Presentation]
Demos
recursion.py
stringfun.py
test_recursion.py
test_stringfun.py


Today we talk about recursion, a powerful computing tool and one of the harder concepts in the course. Recursion is one of the fundamental 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



15 October (Tuesday): FALL BREAK



There is no class today.



Week 7

10 October (Thursday): More with Sequences

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


This lecture will cover several advanced topics on sequences. In particular, we will look at the topic of multi-dimensional lists, and why we would want to use them. We will also introduce dictionaries, which are similar to a sequence, but have several important differences.

Reading: Chapter 11



Lab 6: Lists and For-Loops

[Instructions]

This lab gives you some experience working with lists (in particular, the way that lists differ from strings). It also asks you to write several functions with for-loops in them.

There is no lab the week of Fall Break, so you technically have two weeks to do this lab. However, the material from this lab may be on the exam; therefore, you may want to complete it as soon as possible.


8 October (Tuesday): For-Loops

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


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.

This topic is the last material that (may) appear on the first prelim.

Reading: Sections 8.4, 8.7; Chapter 10



Week 6

3 October (Thursday): Lists (and Sequences)

[Handout]      [Presentation]

Now that you are an expert of string slicing, we introduce another sliceable data type: lists. Lists behave just like strings, except that they can contain data other than text. They are also mutable, which means we need to use folders to represent them.

Reading: Sections 10.0-10.2 and 10.4-10.6



Lab 5: Conditionals and Asserts

[Instructions]
Files
piglatin.py


This lab gives your some experience with conditionals, which we covered over a week ago, and which are necessary for Assignment 3. It also has a few minor questions on asserts and error handling. The exercises in this lab are prime exam questions. In fact, the Pig Latin question is actually from Prelim 1 in a previous semester of CS 1110.


1 October (Tuesday): Asserts and Error Handling

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


Today we complete our discussion of the call stack. We show how it relates to error reporting in Python. We also show how to "recover" from some errors.



Week 5

26 September (Thursday): Memory and the Call Stack

[Handout]      [Presentation]
Demos
name.py


Today we back up a bit, and try to look at the bigger picture. We present an overview of how variables are handled in Python, with regards to global space, call frames, and heap space. We review call frames and put them in the context of call stack, which is the collection of frames for all currently executing functions.

Important: The slides in class had numerous typos. The slides on this web page are the most up-to-date.

Reading: Sections 3.9-3.10



Lab 4: Assignment 1

[Instructions]
Files
lab04.py


In recognition of the length of the last lab and the looming assignment, today's lab is a chance for you to work on assignment 1. You do not have to show to lab, but consultants are available to give you help. You will get credit for the lab so long as you turn in assignment 1 on time.

This lab does have some optional exercises. These are for practice only (you will find them helpful for the exam), and are not required.


24 September (Tuesday): Algorithm Design

[Handout]      [Presentation]
Demos
reorder.py
anglicize.py
test_anglicize.py
error.py


The first assignment is 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

19 September (Thursday): Conditionals and Control Flow

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


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 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 3: Modules and Testing

[Instructions]
Files
demo_test.py
funcs.py
parse.py
test_funcs.py
lab03.zip


This lab is bit longer than the previous ones. This is an intensive, hands-on lab to give you a lot of experience with testing and debugging. You will find these skills extremely useful for the rest of the course. The online version of the lab includes an optional exercise that is very relevant to the first assignment.





17 September (Tuesday): Specifications and Testing

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


Today we cover the last material needed for the first assignment. We learn how to test functions and make sure that they are working properly. In addition, we learn why comments are more important that just as notes to yourself.

Reading: Docstrings in Python



Week 3

12 September (Thursday): Objects

[Handout]      [Presentation]
Demos
pointfuncs.py


Today we finish the function lecture with a discussion of call frames. In addition, we introduce the notion of objects. Objects are a new type of data. They require a new conceptual model for us to understand them.



Lab 2: Functions, Strings, and Modules

[Instructions]

The purpose of this lab is to get you used to the concept of functions (as well as String methods). It is a longer lab than the last one. If you are pressed for time, we highly recommend focus on the last part (where you write your first function).


10 September (Tuesday): User-Defined Functions

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


Now that we know how to use modules, today we learn how to create our own modules. As part of this, we will learn a lot more about functions. In particular, we will learn the difference between a function call and a function definition.

Reading: Sections 3.1-3.8, Sections 6.1-6.4



Week 2

5 September (Thursday): Strings, Functions, and Modules

[Handout]      [Presentation]

Today we go into more detail about the String type, and show just how powerful Python is at manipulating text. We also introduce the concept of modules and show how they provide Python with extra (optional) functionality.

Reading: Chapter 8 (not 8.6, 8.11)



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 Python expressions, which we talked about on the first day of class.


3 September (Tuesday): Variables and Assignments

[Handout]      [Presentation]

In this class, we build on the concepts of types and expressions introduced in the first class. We introduce the notion of a variable, and how an assignment statement works. The topics covered today will prepare you for the first lab.
We will use the iClickers for the first time today.

Reading: Sections 2.2-2.9



Week 1

29 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



Course Material Authors: D. Gries, L. Lee, S. Marschner, & W. White (over the years)