Post

Answer: B) [1, 2, 3, 4]
The key: b = a creates a reference + lists are MUTABLE!
› b and a point to SAME list
› b += [4] works like b.extend([4])
› Modifies in-place, not creates new list
› Shared list becomes [1,2,3,4]
› a sees the change!
For beginners: += with lists behaves like .extend() - modifies in-place!
English

@Python_Dv Understanding this distinction between assignment (creating a new reference) and copying (creating a new, independent object) is crucial for predicting how mutable data structures like lists behave in Python.
B). [1, 2, 3, 4] is the correct answer to the Python code challenge.
English

@Python_Dv B. [1, 2, 3, 4]
b = a doesn't copy the list. It copies the reference.
When you modify b, you're modifying a too.
This is why shallow vs deep copy matters.
English

@Python_Dv b = a → both variables refer to the same list
b += [4] modifies the list in place (it’s like append, not reassignment)
output= [1, 2, 3, 4]
English













