Python Fundamentals

Mutability Review

Python Fundamentals

Check out a free preview of the full Python Fundamentals course

The "Mutability Review" Lesson is part of the full, Python Fundamentals course featured in this preview video. Here's what you'd learn in this lesson:

Nina briefly reviews what mutability is, and covers reinforced which data structures in Python are mutable.


Transcript from the "Mutability Review" Lesson

>> Nina Zakharenko: Let's talk about mutability. I feel like y'all have a pretty clear picture of mutability, but let's take a quick look at this cheat sheet. So mutability simply put is, can the contents of a mutable object be changed? Yes, the contents of an immutable object can't be after it's been created.

So for the simple data types, the ints, floats, strings, booleans, those are all immutable objects, right? We've seen numbers and strings be used as keys in a dictionary. We've seen them be used in sets, right. For the container types, is a list mutable?
>> Nina Zakharenko: Yes. Is a set mutable?

>> Speaker 2: Yes.
>> Nina Zakharenko: Is a dictionary mutable?
>> Speaker 2: Yes.
>> Nina Zakharenko: Is a tuple mutable?
>> Speaker 2: No.
>> Nina Zakharenko: No, you all get gold stars. I'm so proud of you. Okay, that's a lot. This is kind of the longest chapter, but these are some of the most important types that you'll be working with in Python.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now