Tuesday, Thursday
9:05 (ILR 315)
11:15 (Call Aud)

CS 1110: Introduction to Computing Using Python

Fall 2018

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

4 December (Tuesday): 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.



Week 14

29 November (Thursday): 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.

Reading: Appendix B.1-B.3



Lab 12: Sequence Algorithms

[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 work on the lab as a way of studying for the final exam.


27 November (Tuesday): Sequence Algorithms (cont)

[Handout]      [Presentation]
Demos
algorithms.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 14

22 November (Thursday): THANKSGIVING



Gobble, gobble.



20 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: Loop Invariants



Week 13

15 November (Thursday): GUI Applications

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


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.



Lab 11: Loop Invariants

[Instructions]

This second to last lab gives you a lot of practice with loop-invariants. In particular, it shows you how to use invariants to construct a function with a while-loop. While many of you may be able to skip this lab (because you have done all of the labs so far), we recommend that you do not do this. This is one of the major new topics on the final.


13 November (Tuesday): Loop Invariants

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



Week 12

8 November (Thursday): 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



Lab 10: Exceptions and Typing

[Instructions]

This lab finishes up our topics on classes. It is focused both on exceptions and typing objects (either traditional or duck-typing). It is a very short lab. You are welcome to use the rest of the lab to study for the exam or work on the assignment.


6 November (Tuesday): Programming with Subclasses

[Handout]      [Presentation]
Demos
newfrac.py
read.py
trying.py
raising.py


Today we are going to delve in a little deeper with subclasses. To understand how to program with subclasses, we need to understand how to make type more explicit in our programs. We do that in this lecture, including a review of the try-except statement that we saw earlier in the course.

Reading: Exceptions in Python



Week 11

1 November (Thursday): Operators and Abstraction

[Handout]      [Presentation]
Demos
frac1.py
frac2.py
frac3.py
frac4.py
pixels.py
bee.png


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.

The material in this lecture is the last material that will be on the second prelim.



Lab 9: Card Games

[Instructions]

This is an extended lab that gives you some experience working with classes. When you are done, you have a working Blackjack game. The last part of the lab shows you how to implement jokers. While jokers are not used in Blackjack, this assignment is great practice for the prelim.


30 October (Tuesday): Inheritance

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

25 October (Thursday): Using Classes Effectively

[Handout]      [Presentation]
Demos
point.py
rect.py
time1.py
time2.py
card.py
hand.py


In the last lecture, we 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.

Reading: Chapter 17



Lab 8: Lists & Dictionaries

[Instructions]

Because of Fall Break, you never got a proper lab on for-loops. Now that you have seen a lot of sequence data-types (lists, nested-lists, and dictioanaries), it is time for a comprehensive lab on all of them. And there is a class question for good measure.


23 October (Tuesday): Classes

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

18 October (Thursday): Nested Lists and Dictionaries

[Handout]      [Presentation]
Demos
matrix.py
grader.py
weather.py
weather.json


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



Lab 7: Recursion Exercises

[Instructions]

This lab gives you experience with writing recursive functions. All of the functions in this lab are either recursive functions on sequences (e.g. strings or lists), or recursive functions on integers, just as we saw in class.


16 October (Tuesday): More on Recursion

[Handout]      [Presentation]
Demos
morefun.py
testmore.py
palindrome.py
testpalindrome.py
person.py
testperson.py
testperson2.py
hilbert.py


Today we continue to talk about recursion. We look at the different ways that we can break up a recursive function, and more advanced uses of divide-and-conquer. We also look at how recursion is used in Assignment 4.

Reading: Sections 6.5-6.9



Week 8

11 October (Thursday): Recursion

[Handout]      [Presentation]
Demos
factorial.py
fibonacci.py
memory.py
deblank.py
stringfun.py
teststring.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



9 October (Tuesday): FALL BREAK



There is no class today.



Week 7

4 October (Thursday): For-Loops

[Handout]      [Presentation]
Demos
loops.py
ranges.py
files.py
sample.txt


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.3, 8.7, Chapter 10



Lab 6: Asserts & Lists

[Instructions]

With Fall Break and the assignment coming, this is another light lab. You will get some experience using asserts to enforce preconditions. You also get some experience with the list type.

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 is guaranteed to be on the exam. Therefore, you will want to complete it as soon as possible.


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

The material in this lecture is the last material that will be on the first prelim.

Reading: Sections 10.1-10.2 and 10.4-10.6



Week 6

27 September (Thursday): Asserts and Error Handling

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


We have talked about how preconditions are a promise that indicate what your function will and will not do. Today we will show how to make them more than a promise. We will also show how error reporting relates to the call stack.

Reading: Appendix A



Lab 5: Objects & Conditionals

[Instructions]

Now that you are an expert of writing functions, the labs can include more interesting challenges. In this lab, you will learn how to use conditionals in functions. These functions will use strings (just like Assignment 1) as well as a new class called Time.


25 September (Tuesday): Memory in Python

[Handout]      [Presentation]
Demos
globals.py
reorder.py
anglicize.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

20 September (Thursday): Objects

[Handout]      [Presentation]
Demos
pfuncs.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. Objects are a major part of Assignment 3.



Lab 4: Debugging

[Instructions]

In recognition of the looming assignment, today's lab is a bit light. Instead of covering new material, we give you some hands-on exercises for finding errors in some pre-provided functions. However, these functions include conditionals, which are the new control structure covered in class.


18 September (Tuesday): Algorithm Design

[Handout]      [Presentation]
Demos
reorder.py
stub.py
anglicize.py
testang.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: Section 6.2



Week 4

13 September (Thursday): Conditionals and Control Flow

[Handout]      [Presentation]
Demos
flow.py
name.py
debug_name.py
test2.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 3: Strings and Testing

[Instructions]

This week's lab covers the string type, which is the most important type for the first assignment. It also helps you read specifications and test functions. Once you complete this lab, you will be all set for the first assignment.


11 September (Tuesday): Specifications and Testing

[Handout]      [Presentation]
Demos
greet.py
temp.py
name.py
test1.py
test2.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 that just notes to yourself.

Reading: Docstrings in Python



Week 3

6 September (Thursday): Strings

[Handout]      [Presentation]
Demos
greet.py
pvr.py
middle.py
commalist.py


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: Sections 8.1-8.2, 8.5, 8.8



Lab 2: Functions and Modules

[Instructions]

This week's lab is the most important one all semester. It covers a lot of important topics that you will need before you can start on the first assignment. In particular, you will learn how to create modules and scripts, as well as how to write your own functions.


4 September (Tuesday): Defining Functions

[Handout]      [Presentation]
Demos
plusone.py
foo.py
temp.py
globals.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, Sections 6.1-6.3



Week 2

30 August (Thursday): Functions and Modules

[Handout]      [Presentation]
Demos
module.py
script.py
interact.py
helloApp.py
plusone.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 and/or scripts. This will allow us to start programming for real.

Reading: Sections 3.1-3.3



Lab 1: Expressions and Assignments

[Instructions]

The purpose of this lab is to get you comfortable with the very basics of Python: evaluating expressions and assigning variables. While this may seem like a very repetitious lab, you should think of it as a vocabulary-building exercise.


28 August (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

23 August (Thursday): Types and Expressions

[Handout]      [Presentation]
Additional
Course Overview


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: Chapter 1; Section 2.1



Lab 0: Getting Started

[Instructions]

This is a pre-lab. You should attempt very hard to complete it before the first lab. The purpose of this lab is to get Python working on your computer. If you have trouble with this, see a consultant this Sunday, or seek help at the very beginning of your official lab.


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