The quiz where the difficulty automagically adapts to the player's Python knowledge
This is a question page. You can use this page to bookmark a question. Start a new quiz!
Question #113
def change_list(my_list):
my_list= [1, 2, 3, 4]
outer_list = ['a', 'b', 'c', 'd']
change_list(outer_list)
outer_list
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. (docs.python.org/3/faq/programming.html#how-do-i-write-a-f...)
What is the ouput of the code snippet below?
— The Python Quiz (@thepythonquiz) June 27, 2020
def change_list(my_list):
my_list= [1, 2, 3, 4]
outer_list = ['a', 'b', 'c', 'd']
change_list(outer_list)
outer_list
[1, 2, 3, 4]
['a', 'b', 'c', 'd']#python #python3 #pythonprogramming #learnpython
Question difficulty: π΅π΅π΅π΅π΅