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 #130
import copy
a = [[1], [2]]
b = copy.deepcopy(a)
print(a[0] is b[0])
When copy.deepcopy() is used, the copy of the object has a new memory address and its elements have new memory addresses too when they are mutable. Here, a[0] and b[0] are different objects. (towardsdatascience.com/assignment-shallow-or-deep-a-story...)
What is the output of the code snippet below?
— The Python Quiz (@thepythonquiz) August 21, 2020
import copy
a = [[1], [2]]
b = copy.deepcopy(a)
print(a[0] is b[0])
False
True#python #python3 #pythonprogramming #learnpython
Question difficulty: π΅π΅π΅π΅π΅
Similar questions: