popitem() - Removes the last inserted key-value pair

Removes the last key-value pair and returns that key-value pair as a tuple.

Example

Python
fish = {
    'guppy': 2,
    'zebra' : 5,
    'betta': 10
}

lastItem = fish.popitem()
print(fish)
print(f'I no longer have {lastItem}')

Output

{'guppy': 2, 'zebra': 5}
I no longer have ('betta', 10)