Errors

Flash and JavaScript are required for this feature.

Download the video from iTunes U or the Internet Archive.

Description: This in-class question demonstrates error codes in Python.

Instructor: Dr. Ana Bell

The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high-quality educational resources for free. To make a donation or view additional materials from hundreds of MIT courses, visit MIT OpenCourseWare at ocw.mit.edu.

ANA BELL: So let's see if you can figure out this next error. Oh, nice. Looks like 100% are getting it right so far. So we have L is equal to 3 for i in range length L print i. And this is the error message telling me the file, the line number, and the actual line that was wrong and then a description of the error type error. OK?

And everyone's getting it right, which is, what's the problem here? We're not allowed to call length on an integer. OK? If you go through the other choices, you'll see that those you can actually do. And you can even test those out yourself before you settle on the right answer.

Free Downloads

Video


Caption

  • English-US (SRT)