StudyLover
  • Home
  • Study Zone
  • Profiles
  • Typing Tutor
  • Contact us
  • Sign in
StudyLover Mutable 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
Data Structures : Immutable Objects
Unit 3: Getting Started with Python: A Guide to Syntax, Data Structures, and OOP

Mutable means "changeable." When you have a mutable object, you can modify its contents—add, remove, or change elements—without having to create a new object in memory.

  • Analogy: Think of a whiteboard. You can easily erase a word or add a new drawing to the same whiteboard. The whiteboard itself remains the same object.

  • Examples from your Canvas:

    • Lists: The fruits_list is mutable. The code shows how you can change an element (fruits_list[1] = "blueberry") and add a new one (fruits_list.append("orange")) directly to the original list.

    • Dictionaries: The person dictionary is mutable. You can add a new key-value pair (person["email"] = "Neha@example.com") and update an existing value (person["age"] = 30).

    • Sets: The unique_fruits set is mutable. You can add new items (unique_fruits.add("orange")) and remove existing ones (unique_fruits.remove("banana")).


Data Structures Immutable Objects
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