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

CS 1110: Introduction to Computing Using Python

Spring 2018

Lecture Summaries

This page lists a summary of the lectures for 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.


Week 15

8 May (Tuesday): Sorting and Searching and What's Next!

    [Handout]      [Presentation]
Demos
Life After CS 1110

Today we review our Partition function and use it to write QuickSort. Now that we have sorted sequences, we can discuss Linear Search and Binary Search. Finally, we discuss what to take after CS 1110.



Week 14

3 May (Thursday): Sorting

    [Handout]      [Presentation]
Demos
insertion_sort.py
quick_sort.py
algorithms.py

Today we complete our discussion of loop invariants and show how to use them to implement two sorting algorithms: Insertion Sort and Quick Sort.


1 May (Tuesday): Sequence Algorithms

    [Handout]      [Presentation]
Demos
largest_elem.py
separate_pos_neg.py

Today we continue our discussion of loop invariants (the first page of the handout is from the last lecture's presentation), reviewing Tasks 3 and 4 from the Loop Invariants lecture. Then we introduce framework for building complex algorithms on sequences (strings, lists, etc.).



Week 13

26 April (Thursday): 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.

Reading: Loop Invariants


24 April (Tuesday): NO CLASS - open office hours

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



Week 12

19 April (Thursday): Prelim 2 Review Session

    [Handout]
Demos
Questions
Solutions


17 April (Tuesday): Programming with Subclasses

     [Presentation]
Demos
zoology.py
zoo.py

Now that we have subclasses, there is quite a bit we can do with them. Today we'll look at an in-depth example of a Class hierarchy.



Week 11

12 April (Thursday): While Loops

    [Handout]      [Presentation]
Demos
guess_num.py
game.py
hangman.py

While-loops are an alternate form of iteration. Sometimes the right iterative tool for the job will be a for-loop, sometimes it will be a while-loop. So it's good to be familiar with both!

Reading: Section 7.3, 7.4


10 April (Tuesday): Subclasses and Inheritance

    [Handout]      [Presentation]
Demos
shapes.py
draw_shapes.py
compare_shapes.py
shapes_no_eq_override.py
initialize.py
override.py
resolve.py

Today we learn the ins and outs of inheritance: creating classes that are subclasses of existing classes. Subclasses inherit methods from their parent classes, but they can also override these method definitions with their own definitions when appropriate.

Reading: Chapter 18



Week 11

5 April (Thursday): SPRING BREAK

There is no class today.


3 April (Tuesday): SPRING BREAK

There is no class today.



Week 10

29 March (Thursday): Using Classes Effectively

    [Handout]      [Presentation]
Demos
game.py
hangman.py
careful_hangman.py
friendly_hangman.py

In previous lectures, we learned the syntax for defining classes. Today we look at the design philosophy for creating classes.

Reading: Chapter 17


27 March (Tuesday): Classes

    [Handout]      [Presentation]
Demos
worker.py
simple_cs1110.py
cs1110.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: Chapter 15



Week 9

22 March (Thursday): More on recursion

    [Handout]      [Presentation]
Demos
reverse.py
palindrome.py
person.py
family_functions.py
morefun.py
testmore.py
hilbert.py

Delving deeper into how to write a recursive function, what the call stack looks like, and a few mathematical examples.


20 March (Tuesday): Recursion

    [Handout]      [Presentation]
Demos
fortune.py
open_fortune.py
family.py
print_family_members.py
hanoi.py
factorial.py
fibonacci.py
memory.py
stringfun.py
teststring.py

Today we talk about recursion!

Reading: Sections 5.8-5.10



Week 8

15 March (Thursday): Nested Lists, Tuples, and Dictionaries

    [Handout]      [Presentation]

Lists can contain lists, creating two-dimensional structures. A tuple is another built-in type: an immutable sequence of values. Dictionaries are collections of key-value pairs.

Reading: Sections 11.1-11.5, 12.1-12.3


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

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



Week 7

8 March (Thursday): Optional Coding Session

Demos
madlibs.py
8-line mad lib implementation
madlibs_complete.py
ml_quotes.py


6 March (Tuesday): Iteration and For-Loops

    [Handout]      [Presentation]
Demos
cs_ants.py
ants.py
roses.py
inflate.py
ints.py
writeup with more loop examples

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

1 March (Thursday): Lists (and Sequences)

    [Handout]      [Presentation]

A list is a sequence of values that can be of any type. A list of integers could hold a student's lab grades. A list of strings would be appropriate to maintain a shopping list for a trip to the grocery store. They are extremely useful! This lecture will show you how to create and manipulate lists, as well as how to draw them.

Reading: Sections 10.0-10.2, 10.4-10.6, 10.8-10.13


27 February (Tuesday): Memory in Python

    [Handout]      [Presentation]
Demos
birthday.py
birthday_error.py
star_wars_name.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 collection of frames for all currently executing functions).



Week 5

22 February (Thursday): Conditionals and Control Flow

    [Handout]      [Presentation]
Demos
dude_wheres_my_prelim.py

We talk about the difference between program structure and program flow. We 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


20 February (Tuesday): FEBRUARY BREAK

There is no class today.



Week 4

15 February (Thursday): Objects

    [Handout]      [Presentation]
Demos
shapes.py
point_fns.py

We introduce the notion of objects, a new type of data. Objects allow us to go beyond writing functions to organize code and using built-in types to organize data. Objects use programmer-defined types to bundle both code and data into useful and meaningful combinations.

Reading: Chapter 15


13 February (Tuesday): Specifications and Testing

    [Handout]      [Presentation]
Demos
cornell_phone.py
cornellasserts.py
name.py
name_unit_test.py

Writing functions takes a lot of practice and no one writes perfect code on the first try. That is why it is extremely important to test your functions and make sure they are working properly. We will also see why comments are more important than just notes to yourself.

Reading: Sections 4.9, 9.5



Week 3

8 February (Thursday): Strings

    [Handout]      [Presentation]

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

Reading: Sections 8.1, 8.2, 8.4, 8.5, first paragraph of 8.9


6 February (Tuesday): Defining Functions

    [Handout]      [Presentation]
Demos
height.py
simple_math.py
room_numbers.py
scope_example.py

We learn how to create our own functions and the important difference between a function call and a function definition.

Reading: Sections 3.4-3.11



Week 2

1 February (Thursday): Functions and Modules

    [Handout]      [Presentation]
Demos
my_module.py
script.py
bracy_height.py

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


30 January (Tuesday): Variables and Assignments

    [Handout]      [Presentation]

We 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.1-2.3, 2.5



Week 1

25 January (Thursday): Types and Expressions

    [Handout]      [Presentation]

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



Course Material by: E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner, C. Van Loan, W. White