Question 6
Back to Exercise
Which pair does d.popitem() remove?
- A A random pair
- B The first inserted pair
- C The pair with the smallest key
- D The most recently inserted pair Correct
Correct Answer: Option D
Since Python 3.7 popitem() works in LIFO order. It raises KeyError on an empty dict.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!