Session Overview
This lecture introduces the notion of decomposition and abstraction by specification. It also covers Python modules, functions, parameters, and scoping. Finally, it uses the Python assert statement and type 'str'. Image courtesy of The Consumerist on Flickr. |
Session Activities
Lecture Videos
-
Lecture 4: Machine Interpretation of a Program (00:50:18)
Lecture 4: Machine Interpretation of a Program
> Download from iTunes U (MP4 - 111MB)
> Download from Internet Archive (MP4 - 111MB)
About this Video
Topics covered: Decomposition, module, function, abstraction, formal parameter, actual parameter, argument, assert, scope, mapping, stack, last in first out, LIFO, strings, slicing.
Resources
Recitation Videos
-
Recitation 2: Loops, Tuples, Strings and Functions (00:57:42)
Recitation 2: Loops, Tuples, Strings and Functions
> Download from iTunes U (MP4 - 133MB)
> Download from Internet Archive (MP4 - 133MB)
About this Video
Topics covered: Loops, tuples, concatenating tuples and strings, string operations, immutability, range function, slicing, types of data structures, decrementing function, global and local variables, global keepers.
Check Yourself
What is decomposition?
› View/hide answer
Decomposition breaks a problem into self-contained, manageable parts.
What is abstraction?
› View/hide answer
Abstraction allows us to ignore the details of a piece of code, and use it as a black box – input x, get y.
What is the difference between formal and actual parameters?
› View/hide answer
Formal parameters are the names of variables used inside a procedure; actual parameters (or arguments) are the values assigned to those names.
Problem Sets
Problem Set 1: Paying Off Credit Card Debt (Due)
This problem set will introduce you to using control flow in Python and formulating a computational solution to a problem. You will design and write three simple Python programs, test them, and hand them in.
- Instructions (PDF)
- Solutions (ZIP) (This ZIP file contains: 3 .py files.)
Problem Set 2 (Assigned)
Problem set 2 is assigned in this session. The instructions and solutions can be found on the session page where it is due, Lecture 6 Recursion.