T-Th 9:05 or 11:15 in Kimball B11 |
CS 1110: Introduction to Computing Using Python Spring 2013 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Main
About: Announcements Staff Consultants Times & Places Syllabus Materials: Texts Python/Komodo Command Shell Terminology Handouts: Lectures Assignments Labs Assessment: Grading Exams Resources: CMS Piazza (link) Piazza (about) VideoNote AEWs FAQ Python Library Online Python Tutor Style Guide Academic Integrity Authors of these pages: D. Gries, L. Lee, S. Marschner, & W. White, over the years |
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. You may also find the lecture handouts from last semester useful. Week 15Week 142 May (Thursday): Review session
Lab 14: Office hours/check off lab 13
30 April (Tuesday): Grab Bag
[Handout]
Week 1325 April (Thursday): Event-driven Programming[Handout] [Presentation]
Today's lecture is focused on A7: we discuss the design of even-driven GUI programs, and demonstrate implementing a couple of fun interactive programs using the A7 skeleton. The accompanying code here is the finished versions of the programs I worked on in lecture; I'll show more of the development toward the finished states on Tuesday. Lab 13: Subclasses; exceptions
[Instructions]
23 April (Tuesday): 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) Week 1218 April (Thursday): Exceptions and Try-statements[Handout] [Presentation]
What happens when something goes wrong (in Python)? Python runtime errors are objects (of course!) called exceptions. We'll talk about how to handle exceptions gracefully and usefully. The fact that exceptions are part of a class hierarchy will lead us to our next topic, sub-classes and inheritance. Reading: 14.5, A.2.3 Lab 12: Office hours Tuesday/nobody there Wed
16 April (Tuesday): Prof office hours (exam day)
Week 1111 April (Thursday): Review session
[Handout]
[Presentation]
Lab 11: Office hours/check off lab 10
9 April (Tuesday): More Algorithms with Loop Invariants
[Handout]
[Presentation]
Reading: Handout on loop invariants Week 104 April (Thursday): Sequence algorithms[Handout] [Presentation]
Today we talk about how to create complex algorithms on sequences (strings, lists, and tuples) using an invariant-based approach. Full solutions are in the code. Reading: Handout on loop invariants Lab 10: Loop Exercises
[Instructions]
2 April (Tuesday): Loop Invariants
[Handout]
[Presentation]
Week 928 March (Thursday): 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: Chapter 7 Lab 9: Office hours/check off lab 8
26 March (Tuesday): 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 Week 814 March (Thursday): 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 Lab 8: Classes: Blackjack
[Instructions]
12 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 77 March (Thursday): Prof. office hours for Prelim 1
Lab 7: Office hours/work on lab 6
5 March (Tuesday): Review session for Prelim 1Week 628 February (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. Note: presentation version now contains both versions of the “what if no base case” scenario. Reading: (none) Lab 6: Recursion Exercises
[Instructions]
26 February (Tuesday): 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 saw an application to understanding sentential structure in natural language. Reading: Section 5.8-5.10, 6.6 Week 521 February (Thursday): More with Sequences[Handout] [Presentation]
Today we continue looking at what we can do with lists. We learn two ways to process the elements of a list: the map function and the for statement. We look at a few examples of useful programs that can be written succinctly with these tools. We didn't get to how to make multidimensional lists by nesting lists inside other lists. Reading: Sections 10.1-10.2, 10.4-10.6, and 10.8-10.13 Lab 5: Lists; Conditionals: Cards and Poker Hands
[Instructions]
19 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 414 February (Thursday): The Call Stacks; Conditionals
We continue with the concept of call frames, putting it in the context of the “call stack”, which is the ordered collection of frames for all currently executing functions. We also show how this is relevant to error detection in a program. We then switch to the topic of if-statements, and conditional expressions, using a special Valentine's Day demo. No new lecture handout; refer to last lecture. Reading: Sections 3.1-3.10 and 5.1-5.7 Lab 4: Catch-up for labs 2 and 3
12 February (Tuesday): More on Function Calls and Frames[Handout] [Presentation]
We practice more with function calls and the call stack, trying to keep straight what names are available, where these names exist, and what things we can affect inside and outside a function call. Note that presentation slides linked to above show an animated version what happened on the board, more or less (if you can't view powerpoint slides, a static pdf is linked to on the right), and you can run our various attempts to change the speed of light using the lec07.py file (in Python, or perhaps even better, using the Online Python Tutor), and even play around with other possibilities. Reading: Sections 3.9-3.10 Week 37 February (Thursday): 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 Lab 3: Objects, Functions, and Testing
[Instructions]
5 February (Tuesday): 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 Week 231 January (Thursday): Writing Functions; Specifications; Testing[Handout] [Presentation]
Today we show 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 Lab 2: Strings, Functions, and Modules: Scraping Exam Info from the Web
[Instructions]
29 January (Tuesday): More on Strings; Modules; Functions[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 command prompt to using Komodo Edit to write and run Python programs; in doing so, we introduce one debugging technique: judicious use of print statements. We can use functions in our code, some of which are accessed by importing modules. Reading: (Note that these are all short!) Sections 2.6, python files (referred to there as "scripts"); 2.9, comments; 4.9, docstring; 3.3, for import and dot notation; 8.1, 8.2, 8.4, 8.5, 8.8, about string operations, including the dot notation. Don't worry about the "method" terminology (yet); 3.1-3.6, about functions Week 124 January (Thursday): Variables and Assignment; Strings
[Handout]
[Presentation]
Reading: Sections 2.2-2.9 Lab 1: Evaluating Expressions
[Instructions]
22 January (Tuesday): 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 |