T-Th 9:05 |
CS 1110: Introduction to Computing Using Python Spring 2014 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Main
About: Announcements Staff Times & Places Syllabus Materials: Texts/iClickers Python Command Shell Terminology VideoNote Handouts: Lectures Assignments Labs Assessment: Grading Exams Resources: CMS Piazza AEWs FAQ Python Tutor Python Library Style Guide Academic Integrity |
Lecture SummariesThis 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 17Week 166 May (Tuesday): Valediction
[Presentation]
Week 151 May (Thursday): Grab Bag[Handout] [Presentation]
Today we finish up the extended event-driven examples from the previous lecture, and go on to a grab bag of a last few topics that didn't fit in elsewhere (well, OK, we didn't get to the grab bag). The end is nigh! (The files posted here are the code we developed in class, a bit different from the finished versions posted on the last lecture—complete with typos and sketchy comments! Each of them needs game2d.py to run.) 29 April (Tuesday): Models, Views, Controllers, and Games[Handout] [Presentation]
Today's lecture is focused on A5: we discuss the design of even-driven programs, and demonstrate implementing a couple of fun interactive programs using the A5 skeleton. The zip file contains finished versions of examples similar to the one(s) we developed in lecture. Week 1424 April (Thursday): Subclasses and Inheritance[Handout] [Presentation]
In this lecture we discuss inheritance: relationships between classes that make it easy to share code between classes that have to do similar things. Reading: Chapter 17; Chapter 18 (especially 18.7) 22 April (Tuesday): Review session
[Presentation]
Week 1317 April (Thursday): More Algorithms with Loop Invariants[Handout] [Presentation]
Continuation of sequence algorithms using an invariant-based approach. The presentation slides posted here contain the solutions that we did in class. Reading: Handout on loop invariants 15 April (Tuesday): Invariants, quicksort, partition
[Handout]
[Presentation]
Reading: Handout on loop invariants Week 1210 April (Thursday): Loop Invariants[Handout] [Presentation]
This lecture advances our understanding of the technique of using loop invariants to reason about the correctness of code that uses loops. The demo code contains functions that all do exactly the same thing, but are based on different invariants or implementations of those variants, for both while-loops and for-loops. One version is a skeleton for you to practice coding with: you're given the invariant to work with. The other version has full solutions, and in certain cases gives two solutions for the same invariant. Reading: Writeup and worked exercises on loop invariants 8 April (Tuesday): While Loops[Handout] [Presentation]
In this lecture we introduce while loops and begin talking about iteration and how to use it effectively. We develop several simple iterative functions using for and while loops. Reading: Writeup and worked examples on loop invariants (plus section 7.3 of the text) Week 11Week 1027 March (Thursday): Monte Carlo Card Tricks[Handout] [Presentation]
In this lecture we do “coding theater,” implementing a program that uses a simple Monte Carlo method to find out the probabilities of various hands in various versions of poker. Along the way we see a few more odds and ends of the Python language, as well as some implementation patterns that you can adapt to your own code later. The Zip file of code contains a finished version of the program, as well as the starting state and the states at the end of each of the lectures, so you can see what you remember us doing in class. Reading: Chapter 18 25 March (Tuesday): Using Classes Effectively[Handout] [Presentation]
Today we look at how to use the mechanisms of classes and objects that we saw in the previous lecture to implement well-behaved classes. Reading: Chapters 15, 16 Week 920 March (Thursday): Back to recursion[Handout] [Presentation]
We cover some more examples of recursion, with some of our discussion in the context of A3. The animate.py script can be used by you to visualize "animated" versions of trials once your code is working. 18 March (Tuesday): Defining and Using Classes[Handout] [Presentation]
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 how classes actually work, and how to define new ones. Reading: Chapters 15, 16 Week 813 March (Thursday): More on Recursion[Handout] [Presentation]
We consider what happens on the call stack when a recursive function is executed, and we look at different ways that we can break up the input to a recursive method. Reading: (none) 11 March (Tuesday): Review session for Prelim 1
[Presentation]
Week 76 March (Thursday): Recursion[Handout] [Presentation]
Today we introduce recursion. Recursion is one of the fundamental principles of computer science, and is used for a lot of advanced algorithms. We see an application to understanding sentential structure in natural language. Reading: Section 5.8-5.10, 6.6 4 March (Tuesday): Iteration over sequences[Handout] [Presentation]
Today we introduce two ways to do something for each item of a list (or other sequence). The built-in function "map" will call a function once for each item in a list. Or you can use the "for" statement to execute a block of one or more statements for each item in a list. Reading: Section 10.3, 10.7 Week 627 February (Thursday): More with Sequences
[Handout]
[Presentation]
Reading: Sections 10.1-10.2, 10.4-10.6, and 10.8-10.13 25 February (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 and can contain objects of any type. We will see why this is important. Reading: Sections 10.1-10.2, 10.4-10.6, and 10.8-10.13 Week 520 February (Thursday): Conditionals[Handout] [Presentation]
If-statements, and conditional expressions, using a post-Valentine's-Day demo. Reading: 5.4-5.7 Week 413 February (Thursday): More on Function Calls and Frames[Handout] [Presentation]
We practice more with function calls and call frames, trying to keep straight what names are available, where these names exist, and what things we can affect inside and outside a frame. The version of the presentation slides posted here contain pseudo-animated solutions to all the exercises we did in class. You can also visualize the solutions in the Online Python Tutor using the simplified snippets included in the lec07_pythontutorized.py file. (Handling imports of external modules is a little tricky in the Python Tutor.) Reading: Sections 3.9-3.10 11 February (Tuesday): Function Calls; Call Frames[Handout] [Presentation]
We look more closely at what goes on when you call a function. We introduce call frames, the paper-and-pencil model for function calls, and use them to show what happens with parameters, arguments, and local and global variables. Reading: Sections 3.7-3.14 Week 36 February (Thursday): Objects[Handout] [Presentation]
Objects are a more general data type. To understand them, we introduce the folder metaphor which we will use throughout this course. Reading: Sections 3.5-3.13 and 6.1-6.4 4 February (Tuesday): Writing Functions; Specifications; Testing[Handout] [Presentation]
Today we see how to use pre-written functions and how to define our own functions, stressing the importance of good specifications and testing. We introduce the unit-test method of organizing test cases. Reading: Sections 3.1-3.6; 4.9 (docstring); 14.9 (writing modules) Week 230 January (Thursday): More on Strings; Files[Handout] [Presentation]
We first practice doing extraction of data from strings. As we perform longer sequences of operations, we move away from working at the Python prompt to using Komodo Edit to write Python programs, running them using the command shell. The python demos include multiple solutions to the string-processing puzzles, the second of which we didn't get to in lecture but can be seen on the note-taking handout. Reading: 8.1-8.2; 8.4; 8.8-8.9 28 January (Tuesday): Variables and Assignment; Strings
[Handout]
[Presentation]
Reading: Sections 2.2-2.9 Week 123 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. 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) |