Identity vs. Equality: exam-level questions

If you need help reviewing Identity vs. Equality, take a look at these resources:

Each question has a "Toggle Solution" button -- click it to reveal that question's solution.

What would Python print?

Question 1

>>> def outer():
...     def inner():
...         return 42
...     return inner
>>> outer is outer
______
>>> outer() is outer()
______
>>> outer() == outer()
______
>>> [1, 2, (3, 4)] == [1, 2, (3, 4)]
______
>>> [1, 2, outer()] == [1, 2, outer()]
______

Question 2

>>> a = [1, 2, 3, 4]
>>> a[0] = a
>>> a is a[0]
______
>>> a = {'hi': 3}
>>> b = {'hi': 3}
>>> a is b
______
>>> a == b
______
>>> a['hi'] = 10
>>> a == b
______