StudyLover
  • Home
  • Study Zone
  • Profiles
  • Typing Tutor
  • Contact us
  • Sign in
StudyLover Immutable Objects
Download
  1. Python
  2. Pyhton MCA (Machine Learning using Python)
  3. Unit 3: Getting Started with Python: A Guide to Syntax, Data Structures, and OOP
Mutable Objects : List
Unit 3: Getting Started with Python: A Guide to Syntax, Data Structures, and OOP

Immutable means "unchangeable." Once an immutable object is created, its value cannot be altered. Any operation that seems to modify it will actually create a brand new object in memory.

  • Analogy: Think of a signed contract. If you need to change a term, you can't just erase it; you have to create an entirely new contract with the updated information.

  • Examples from your Canvas:

    • Tuples: The coordinates tuple is immutable. The code notes that trying to change an element (coordinates[0] = 5.0) would cause an error.

    • Strings, Integers, Floats: These are also immutable. When you do x = 5 and then x = x + 1, you are not changing the number 5. You are creating a new number 6 and reassigning the variable x to point to it.

 

Mutable Objects List
Our Products & Services
  • Home
Connect with us
  • Contact us
  • +91 82955 87844
  • Rk6yadav@gmail.com

StudyLover - About us

The Best knowledge for Best people.

Copyright © StudyLover
Powered by Odoo - Create a free website