Session Overview
This lecture completes the introduction of classes by showing a way to implement user-defined iterators. It then discusses simulation models, and illustrates some of the ideas underlying simulations modeling by simulating a random walk. Image courtesy of donovanbeeson on Flickr. |
Session Activities
Lecture Videos
-
Lecture 12: Introduction to Simulation and Random Walks (00:50:24)
Lecture 12: Introduction to Simulation and Random Walks
> Download from iTunes U (MP4 - 110MB)
> Download from Internet Archive (MP4 - 110MB)
About this Video
Topics covered: Subclasses, inheritance, generator, analytic methods, simulation methods, simulations, models, random walk.
Resources
Check Yourself
What is a generator?
› View/hide answer
A function that remembers the point in the function body where it last returned a value and the values of all local variables.
What is the difference between yield and return?
› View/hide answer
When yield is used, the state of the function is not lost.
What is a model?
› View/hide answer
A model is a theoretical construct that will provide useful information about the possible behaviors of the system being modeled.
Problem Sets
Problem Set 5: RSS Feed Filter (Due)
In problem set 5, you will build a program to monitor news feeds over the Internet. Your program will filter the news, alerting the user when it notices a news story that matches that user's interests (for example, the user may be interested in a notification whenever a story related to the Red Sox is posted).
- Instructions (PDF)
- Code Files (ZIP) (This file contains 1 .txt file, 3 .pyc files, and 6 .py files.)
- Solutions (ZIP) (This ZIP file contains: 1 .py file.)
Problem Set 6 (Assigned)
Problem set 6 is assigned in this session. The instructions and solutions can be found on the session page where it is due, Lecture 14 Sampling and Monte Carlo Simulation.