Question:medium

In Python, which data type is immutable?

Show Hint

Think of a List as a pencil-written list (you can erase and change it) and a Tuple as one written in permanent ink. Use Tuples when you want to make sure your data stays constant throughout the program.
Updated On: May 30, 2026
  • List
  • Dictionary
  • Set
  • Tuple
Show Solution

The Correct Option is D

Solution and Explanation

Step 1: Understanding the Concept:
In Python, an object is "immutable" if its value cannot be changed after it is created.
Step 2: Detailed Explanation:
- List: Mutable. You can append, remove, or change elements using index assignment (e.g., \( a[0] = 10 \)).
- Dictionary: Mutable. You can add new key-value pairs or update existing ones.
- Set: Mutable. You can add or remove items from a set.
- Tuple: Immutable. Once a tuple is created (e.g., \( t = (1, 2) \)), you cannot modify its contents. Attempting to do so results in a TypeError.
Step 3: Final Answer:
The Tuple is the only immutable data type among the options provided.
Was this answer helpful?
0


Questions Asked in CUET (UG) exam