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 #126
a = [1, 2, 3]
b = a.copy()
a = a.append(5)
print(b)
When a is copied to b with copy() , Python create a new object as a copy from the list assigned to a . Any changes done to the list assigned to a is not reflected when accessing b as a different list is assigned to it. (stackoverflow.com/questions/2612802/how-to-clone-or-copy-...)
What is the output of the code snippet below?
— The Python Quiz (@thepythonquiz) November 30, 2020
a = [1, 2, 3]
b = a.copy()
a = a.append(5)
print(b)
[1, 2, 3]
[1, 2, 3, 5]#python #python3 #pythonprogramming #learnpython
Question difficulty: π΅π΅π΅π΅π΅
Similar questions: