Post

@Python_Dv B) [1]
a = b = [] → both point to the SAME list
a.append(1) → modifies that shared list
print(b) → [1]
The tricky part: "=" doesn't copy, it creates a reference. Welcome to Python's mutable object trap.
English

@Python_Dv Output: B) [1]
Explanation:
a and b point to the same list.
a.append(1) mutates that shared list, so b sees the change too.
English

@Python_Dv B) [1]
a and b reference the same list, so appending via a affects b too.
English

@Python_Dv (B) [1]
When the line a = b = [] is executed in Python, a single empty list object is created in memory, and both variables a and b are made to refer to this exact same object. Lists are mutable objects, meaning their content can be changed after creation without creating a new
English

@Python_Dv B because a gets appended and a=b so B get’s what A gets.
English

@Python_Dv a = b = [] → both a and b refer to the same list
But oppened is not a valid list method
So Python raises an Error
English


















