educative.io

Popitem() why it change from : to ,

why does the pair - “Red”: “Stop” after pop out of the dictionary become “Red”, “Stop”?


Course: Educative: Interactive Courses for Software Developers
Lesson: Educative: Interactive Courses for Software Developers

Hi @jessie_Zhao,

All the methods of dictionary dict in python which contains the word item returns tuple, so if you call either popitem() or items(), you will get tuple(s).

I hope I have answered your question but if there is any confusion please feel free to ask me. Thank you so much for reaching out to us.

2 Likes