Removes and returns the last inserted (key, value) pair.
Syntax
dict.popitem()Example
Enter values below to update the example in real time.
person→item→popitem→print→person = {"name": "Alice", "age": 30}
item = person.popitem()
print(item) # ('age', 30)
print(person) # {'name': 'Alice'}