Machine Interpretation of a Program

OCW Scholar

« Previous | Next »

Session Overview

Photograph of scissors cutting a credit card.

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

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

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.

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.

« Previous | Next »