Explanation:
๐น Step 1: Create Tuple
x = (1,[2,3])
x is a tuple (immutable)
Inside tuple:
1 → integer
[2,3] → mutable list
๐น Step 2: Apply += Operation
x[1] += [4]
๐ This works in two steps internally:
๐ธ Step 2.1: Modify List (In-place)
[2,3] += [4] → [2,3,4]
List is mutable → gets updated ✅
๐ธ Step 2.2: Try to Reassign
x[1] = [2,3,4]
Tuple is immutable ❌
Reassignment is not allowed
๐น Step 3: Error Occurs
Python throws:
TypeError
๐น Step 4: Print Not Executed
print(x)
This line never runs because program stops at error
⚡ Final Output
Error
