Quiz: The Python Object Model
Apply your understanding of Python’s object model, including object identity, mutability, introspection, and dunder methods, through practice questions.
We'll cover the following...
We'll cover the following...
Technical Quiz
1.
We execute the following code. What does the final equality check output, and why?
a = [1, 2, 3]
b = a
c = [1, 2, 3]
print(a is b, a is c, b == c)
A.
True, True, True: All three variables hold the same values, so they are identical.
B.
True, False, True: a and b reference the same object, while c is a new object with the same content.
C.
False, False, True: Lists are mutable, so every assignment creates a new copy in memory.
D.
True, False, False: c is a different object, so it cannot be equal to b.
1 / 10
...