Question #125

What is the output of the code snippet below?
a = [1, 2, 3]
b = a
a = a.append(5)

When a is copied to b , Python create a reference from b to the list assigned to a . As a list is a mutable object, any changes done to the list is reflected when accessing the list from b . (

Comment on Disqus:

Comment on Twitter:

Question difficulty: πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅

Similar questions: