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

CS 1110: Introduction to Computing Using Python

Fall 2014

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

4 December (Thursday): Course Wrap-Up

[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 13: More Loop Invariants

[Instructions]

This lab is completely optional. However, if you can do all of the problems on this lab, you should do well on the final.


2 December (Tuesday): Searching and Sorting

[Handout]      [Presentation]
Demos
algorithms.py


Today we complete our discussion of loop invariants and show how to use them to implement sorting. This is the last lecture covering material on the exam.



Week 14

27 November (Thursday): THANKSGIVING





25 November (Tuesday): Sequence Algorithms (cont)

[Handout]      [Presentation]
Demos
algorithms.py


Today is a bit of catch-up lecture to get us back on track for the last week of class. We finish up the final controller example from the previous lecture. We also continue the discussion of sequence algorithms from last Tuesday.



Week 13

20 November (Thursday): Stateful Controllers

[Handout]      [Presentation]
Demos
animation.py
state.py
touch.py
pyro.py
game2d.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: Chapter 19



Lab 12: Loop Invariants

[Instructions]

This is the last required lab of the course. 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.


18 November (Tuesday): 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



Week 12

13 November (Thursday): Loop Invariants

[Handout]      [Presentation]
Demos
pairs.py
loop_invariants.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 final labs.

Reading: Loop Invariants



Lab 11: Loop Exercises

[Instructions]

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


11 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 part of the course.

Reading: Chapter 7



Week 11

6 November (Thursday): Classes and 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 10: Subclasses and Encapsulation

[Instructions]

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 some additional exercises with methods, particularly with getters and setters.


4 November (Tuesday): Inheritance

[Handout]      [Presentation]
Demos
app.py
employee.py
initialize.py
resolve.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

30 October (Thursday): Using Classes Effectively

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


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



Lab 9: Blackjack

[Instructions]

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.


28 October (Tuesday): Methods and Encapsulation

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


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 also introduce the notion of encapsulation and how it relates to the class invariant.

Reading: Chapter 17



Week 9

23 October (Thursday): Classes

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



Lab 8: 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.


21 October (Tuesday): More on Recursion

[Handout]      [Presentation]
Demos
stringfun.py
morefun.py
person.py
test_stringfun.py
test_morefun.py
test_person.py
hilbert.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 7

16 October (Thursday): Recursion

[Handout]      [Presentation]
Demos
recursion.py
stringfun.py
test_recursion.py
test_stringfun.py
fibonacci.py
deblank.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



14 October (Tuesday): FALL BREAK



There is no class today.



9 October (Thursday): Exam Review



This class is dedicated to reviewing the topics on the first prelim. There are no additional handouts or code demos for this day. The review session is centered around the review materials available on the exam page.



Lab 7: For-Loops

[Instructions]

This lab gives you a lot of functions about for-loops. You will need to write for-loops over both lists and dictionaries. 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.


7 October (Tuesday): More with Sequences

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


This lecture covers 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 also introduce dictionaries, which are similar to a sequence, but have several important differences.

Reading: Chapter 11



Week 6

2 October (Thursday): 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.

Reading: Sections 8.4, 8.7, Chapter 10



Lab 6: Lists and Asserts

[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 there are a few minor questions on asserts and error handling.


30 September (Tuesday): 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



Week 5

Lab 5: Objects and Conditionals

[Instructions]

Now that you are an expert of writing functions, our labs can start involving more interesting challenges. In this lab, we show how to use conditionals in functions. Our functions will use strings (just like Assignment 1) as well as a new class called Time.


23 September (Tuesday): Algorithm Design

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


Your 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

18 September (Thursday): Conditionals and Control Flow

[Handout]      [Presentation]
Demos
tuple3d.py
pointfuncs.py
flow.py
debug_name.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: Assignment 1

[Instructions]

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.

With that said, this lab does include some optional exercises, should you want extra practice.


16 September (Tuesday): Memory in Python

[Handout]      [Presentation]
Demos
globals.py


One of the problems with the new calendar is that the labs and the lectures do not match up as nicely. So I think people have been getting confused about all these memory representation issues (e.g. call frames, objects). Today, we are going to try to ease your confusion with an overview lecture that reviews all of these concepts and puts them together.



Week 3

11 September (Thursday): Objects

[Handout]      [Presentation]
Demos
tuple3d.py
pointfuncs.py
point_tutor.py


We got a little rushed last time. To help you with Assignment 1, we will finish off with Tuesday's lecture, so that you can better understand testing and debuggging.

Once that is done, we will introduce the notion of Objects. Objects are a new type of value, beyond the basic four that we have seen already. They require a new conceptual model for us to understand them.



Lab 3: Functions and Testing

[Instructions]

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 should try very hard to complete this lab before you finish the first assignment; you will need these skills for that assignment.





9 September (Tuesday): Visualizing Functions

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


Today we go into much more depth about functions. We talk about how they work, and present a formal model of execution. We also learn how to test functions and make sure that they are working properly. After this lecture, you should be able to get started with Assignment 1.

Reading: Sections 6.1-6.4



Week 2

4 September (Thursday): Functions

[Handout]      [Presentation]
Demos
module.py
greet.py
temperature.py
commalist.py
print_return.py
Additional
Docstrings in Python


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



Lab 2: Assignments and Strings

[Instructions]

The purpose of this lab is to get you comfortable with using assignment statements, strings, and their associated methods. These are all a major part of the first assignment.


2 September (Tuesday): Strings 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)



Week 1

28 August (Thursday): 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.
We will use the iClickers for the first time today.

Reading: Sections 2.2-2.9



Lab 1: Getting Started

[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.


26 August (Tuesday): 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)