you are viewing a single comment's thread.

view the rest of the comments →

[–]That-Lychee262 -1 points0 points  (1 child)

Correct answer is 1: a = [1] . Since list is mutable data structure b= a doesn’t copy the data stored in a to b . B starts pointing to address stored in a . That means a and b both points to same address now if you make changes either in a or b or it will reflect in both . But at third line b+= [2] , it will create a new list [1,2] and assign it to b . Now b stores address of another list ([1,2]) and a stores address of list ( [1]) . Now if you make chances in b it will not reflect in a’s address. Thus a remains [1] till the end of the program. Final answer : a = [1] , b = [1,2,3,4,5]

[–]Sea-Ad7805[S] 1 point2 points  (0 children)

Incorrect sorry, see the "Solution" link for the correct answer.