Question #113

What is the ouput of the code snippet below?
def change_list(my_list):
    my_list= [1, 2, 3, 4]
outer_list = ['a', 'b', 'c', 'd']

In Python, arguments are passed by assignment. In the example above, when outer_list is passed as an argument to change_list() , only a reference to the list is actually passed. If the object is mutated within the function, the outer scope will know nothing about this mutation. (

Comment on Disqus:

Comment on Twitter:

Question difficulty: 🔵🔵🔵🔵🔵