Q. What does `popitem()` do in a dictionary?

  • (A) Removes all items
  • (B) Removes an arbitrary key-value pair
  • (C) Removes the first item
  • (D) Removes the last inserted key-value pair
πŸ’¬ Discuss
βœ… Correct Answer: (D) Removes the last inserted key-value pair
Explanation: In Python 3.7+, `popitem()` removes and returns the last inserted item.
Explanation by: Mr. Dubey
In Python 3.7+, `popitem()` removes and returns the last inserted item.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
85
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
96%
Success Rate