M, F 2:30-3:20
in Olin 218

CS 1133: Transition to Python

Fall 2013

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 6

11 October (Friday): Numpy and Scientific Computing



We have teased about it all semester. The last class we will talk about the power of numpy, and how you can use it to create high-performance mathematical calculations in Python.



Lab 5: Subclasses

[Instructions]

The last lab will give you some experience with writing subclasses in Python. As we mentioned in class, subclassing is very useful when working with GUI widgets. You will see that first hand, as you work on a cool drawing activity in Kivy.


7 October (Monday): Exceptions and Error Handling

[Presentation]
Demos
try.py
recover.py
typing.py


Last week we saw how to create errors. This lecture we saw how to recover from them, using the try-except control structure. Because of how Python handles errors, this required a bit of understanding of subclasses.



Week 5

4 October (Friday): Subclasses and Inheritance

[Presentation]
Demos
employee.py
app.py


This class completed our discussion of object oriented programming in Python. We saw how subclassing works in Python, and how we can use it to make relatively complex programs.



Lab 4: Blackjack

[Instructions]

This lab is a lot shorter than you might realize at first glance. You already have enough work with the assignment due this week, so we just wanted a simple assignment to give you some practice with classes and methods.


30 September (Monday): Advanced Class Design

[Presentation]
Demos
anglicize.py
fraction.py
betterfraction.py
bestfraction.py


Today we continued Friday's lecture with even more OO programming in Python. We learned about asserts, and how to enforce preconditions. We combined this with properties to show how to enforce class invariants.



Week 4

27 September (Friday): Classes

[Presentation]
Demos
example.py
example2.py
point.py
worker.py


Today we covered the basics of OO programming in Python. We learned how to write a class definition complete with methods, and how to add attributes to an object (or to a class). We also learned a little bit about the mysterious built-in methods of Python



Lab 3: Lists and Control Structures

[Instructions]

Finally, we get to the basic control structures like if and for. The latter requires the use of lists, which we introduced last week. This lab puts them all together and asks you to write some simple functions.


23 September (Monday): Control Structures

[Presentation]
Demos
if_flow.py
while_flow.py
for_loops.py
loops.py
grades.py


Today was a whirlwind day as we learned how to use every major control structure in Python: if, while, and for. In particular, we saw that for-loops are very different in Python than in other languages.



Week 3

20 September (Friday): Objects and Lists

[Presentation]

Today we talked about several new data types. We were introduced to objects and the folder metaphor (which represents reference types). We also saw lists, and how the folder metaphore applies to them as well.



Lab 2: Modules and Testing

[Instructions]

This lab covers the basics of unit testing in Python. You will find it very helpful for the first assignment.


16 September (Monday): Specifications and Testing

[Presentation]
Demos
greet.py
name.py
test_name.py
debug_name.py
temperature.py


Today we talked in more detail about specifications and why they are important. In addition, we showed how to construct unit tests using the cornelltest module. This will be important for the first assignment.



Week 2

13 September (Friday): User Defined Functions

[Presentation]
Demos
module.py
greet.py
temperature.py
commalist.py


Today we showed how to create your own modules and define functions in Python. We also showed off the Python Tutor (see link on web page), which is a great way to visualize Python code.

Reading: Chapter 3, Sections 6.1-6.4



Lab 1: Modules and Objects

[Instructions]

The first lab is a simple language drill to get you used to Python. It is a review of all of the things that we have talked about in class so far. We promise that later labs will be more interesting.


9 September (Monday): Strings, Functions and Modules

[Presentation]

Today we went into more detail about the String type, and show just how powerful Python is at manipulating text. We also introduced the concept of modules and show how they provide Python with extra (optional) functionality.

Reading: Chapter 8 (not 8.6, 8.11)



Week 1

6 September (Friday): Expressions and Variables

[Presentation]

The first class was sort of a "jam session", trying out Python. We learned how to start up Python, and play with expressions and variables. We also learned the basic types of Pythons, and why types are important.

The slides attached are actually a "summary" of all the things we covered. We decided that this is the approach we want to take to the course in general. While each day will have a theme, we will talk about whatever anyone wants to talk about, and then we will post summary slides after the class.

Reading: Chapters 1 and 2