In this example we will show how to remove the last inserted item using the popitem() method in Python.
Source Code
mydict = {
'name': 'Steven',
'age': 24,
'ID': 123456
}
mydict.popitem()
print(mydict)
Output:
{'name': 'Steven', 'age': 24}