Objects in Python

OCW Scholar

« Previous | Next »

Session Overview

Photograph of an open dictionary.

This lecture introduces Python tuples, lists, and dictionaries, as well as the concept of mutability and how to avoid problems relating to it.

Image courtesy of enter on Flickr.

Session Activities

Lecture Videos

About this Video

Topics covered: Tuples, lists, dictionaries, methods, identifiers, modifying objects, aliasing, mutability.


Check Yourself

What is mutability?

View/hide answer

A mutable object's values can be changed; we must be careful when working with mutable objects not to inadvertently change them.



What is the important difference between a list and a tuple?

View/hide answer

Tuples are immutable (as are strings).



What is cloning?

View/hide answer

Cloning creates a copy of a mutable object, so that the values can be manipulated without mutating the original object.



What are the important aspects of a dictionary?

View/hide answer

A dictionary is mutable, with immutable keys, and unordered.



Further Study

These optional resources are provided for students that wish to explore this topic more fully.


After watching the lecture, you may want to read some of the following resources:


« Previous | Next »