0% found this document useful (0 votes)
12 views

Objects in Python: Session Overview

This lecture introduces Python tuples, lists, and dictionaries as well as the concepts of mutability and how to avoid problems related to mutable objects. It discusses tuples and lists, noting that tuples are immutable unlike lists. It also covers dictionaries, explaining that they are mutable with immutable keys and unordered.

Uploaded by

CoursePin
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Objects in Python: Session Overview

This lecture introduces Python tuples, lists, and dictionaries as well as the concepts of mutability and how to avoid problems related to mutable objects. It discusses tuples and lists, noting that tuples are immutable unlike lists. It also covers dictionaries, explaining that they are mutable with immutable keys and unordered.

Uploaded by

CoursePin
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Objects in Python

Session Overview
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

Lecture 5: Objects in Python (00:50:59)

About this Video Topics covered: Tuples, lists, dictionaries, methods, identifiers, modifying objects, aliasing, mutability. Resources

Lecture code handout (PDF) Lecture code (PY)

Check Yourself
What is mutability? 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? answer Tuples are immutable (as are strings).

What is cloning? 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? 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. Readings After watching the lecture, you may want to read some of the following resources:

8. Lists. How to Think Like a Computer Scientist. 9. Tuples. How to Think Like a Computer Scientist. 10. Dictionaries. How to Think Like a Computer Scientist. 5.1 More on Lists. Python Tutorial. 5.3 Tuples as Sequences. Python Tutorial. 5.5 Dictionaries. Python Tutorial.

You might also like