First a pointed to the string "Dog". Then you changed the variable a to point at a new string "Dog eats treats". You didn't actually mutate the string "Dog". Strings are immutable, variables can point at whatever they want.

Answer from Bort on Stack Overflow
🌐
Austin Z. Henley
austinhenley.com › blog › pythonstringsaremutable.html
Python strings are immutable, but only sometimes - Austin Z. Henley
February 15, 2021 - The standard wisdom is that Python strings are immutable. You can't change a string's value, only the reference to the string. Like so: ... Which implies that each time you make a change to a string variable, you are actually producing a brand ...
People also ask

Can I modify a string in Python?
No, you cannot modify a string directly. Any change creates a new string, and the original remains unchanged.
🌐
guvi.in
guvi.in › blog › python › is a string mutable in python? let’s have a look at the concept
Is a String Mutable in Python? Let’s Have a Look
Why are Python strings immutable?
Python strings are designed to be immutable to make them more reliable, efficient, and safe, especially when used in memory or as dictionary keys.
🌐
guvi.in
guvi.in › blog › python › is a string mutable in python? let’s have a look at the concept
Is a String Mutable in Python? Let’s Have a Look
What’s the difference between modifying a string and reassigning a variable?
Modifying a string tries to change the original (not allowed). Reassigning a variable simply makes it point to a new string, leaving the original untouched.
🌐
guvi.in
guvi.in › blog › python › is a string mutable in python? let’s have a look at the concept
Is a String Mutable in Python? Let’s Have a Look
🌐
GeeksforGeeks
geeksforgeeks.org › python › why-are-python-strings-immutable
Why are Python Strings Immutable? - GeeksforGeeks
October 13, 2025 - Strings in Python are "immutable" i.e. they cannot be changed after they are created. Strings are immutable by design to keep them safe, consistent, and efficient.
🌐
GUVI
guvi.in › blog › python › is a string mutable in python? let’s have a look at the concept
Is a String Mutable in Python? Let’s Have a Look
February 3, 2026 - Strings in Python are immutable, which means you can’t change them directly—any modification creates a new string while the original stays the same.
🌐
Reddit
reddit.com › r/learnprogramming › what does 'strings are immutable' mean?
r/learnprogramming on Reddit: What does 'Strings are immutable' mean?
September 29, 2022 -

I'm using Treehouse for Python basics and the tutor mentions this in the context of reassigning a value to a string variable. But if the value of the string variable can be reassigned, what does it mean to say it's immutable? Is there something I'm just not getting? Thanks.

Find elsewhere
🌐
Real Python
realpython.com › python-mutable-vs-immutable-types
Python's Mutable vs Immutable Types: What's the Difference? – Real Python
January 26, 2025 - Python lists are mutable, allowing you to change, add, or remove elements. Strings in Python are immutable, meaning you can’t change their content after creation. To check if an object is mutable, you can try altering its contents.
🌐
Kadenfrisk
python.kadenfrisk.com › strings in python › string immutability
Python String Immutability | Fluffy's Python Course
In Python, strings are immutable. This means that once a string object is created, its content cannot be changed. Any operation that appears to modify a string actually creates a new string object.
🌐
Medium
medium.com › @mvenkatashivaditya › why-are-strings-immutable-in-python-bfdbf1c1199a
Why Python Strings Are Immutable — and Why It Matters | by Shivaditya Meduri | Medium
May 13, 2025 - If you are already familiar with the concept of immutability, you can skip this section. Immutable objects cannot be modified and mutable objects can be modified. It is as simple as that.
🌐
Physics Forums
physicsforums.com › other sciences › programming and computer science
Are Python strings truly immutable? • Physics Forums
September 23, 2022 - There is no conceptual difference between the int code and string code above. At the level of Python functionality (which I distinguish from Python interpreter implementation) strings are mutable.
🌐
Educative
educative.io › answers › why-are-strings-in-python-immutable
Why are strings in Python immutable?
In Python, strings are made immutable so that programmers cannot alter the contents of the object (even by mistake). This avoids unnecessary bugs. Some other immutable objects are integer, float, tuple, and bool.
🌐
AmbitionBox
ambitionbox.com › home › interviews › interview questions
Is a string mutable or immutable in Python? (Asked in 4 companies) - AmbitionBox
Strings in Python are immutable. Once a string object is created, its contents (individual characters) cannot be changed — operations like concatenation, slicing or calling string methods return new string obje...read more
🌐
Great Learning
mygreatlearning.com › blog › it/software development › understanding mutable and immutable in python
Understand What is Mutable and Immutable in Python
October 14, 2024 - This is because they support the same sequence operations as strings. We all know that strings are immutable. The index operator will select an element from a tuple just like in a string.
🌐
Medium
medium.com › better-programming › pointers-strings-and-im-mutability-680b15dd4a70
Pointers, Strings, and (im)mutability in Python | by Danny D. Leybzon | Better Programming
June 19, 2022 - Wrong! Any Python aficionado will tell you that Python strings are “immutable”, meaning that they can’t be modified directly. Instead, when you try to modify a string, Python will create a new object in memory based on the mutation that ...
🌐
TutorialsPoint
tutorialspoint.com › python_text_processing › python_string_immutability.htm
Python Text Processing - String Immutability
In python, the string data types are immutable. Which means a string value cannot be updated. We can verify this by trying to update a part of the string which will led us to an error.
🌐
Runestone Academy
runestone.academy › ns › books › published › fopp › TransformingSequences › Mutability.html
9.2. Mutability — Foundations of Python Programming
For example, in the following code, we would like to change the first letter of greeting. Instead of producing the output Jello, world!, this code produces the runtime error TypeError: 'str' object does not support item assignment. Strings are immutable, which means you cannot change an existing ...
🌐
Medium
medium.com › @float_and_confused › but-i-did-change-the-string-1ea3bab972db
Mutable vs Immutable in Python: Beginner’s Guide | Medium
June 16, 2025 - In C++, string is mutable. You can change individual characters directly using []. ... Python strings are immutable, so you can’t change part of the string.