The 'popitem( )' Function is used to remove the last inserted element from the Dictionary.
x = { 5 : "Is a Number", "John": "Is a Name", "Python": "Is a Language" } x.popitem() print(x)
So, in the above code we have created a 'Dictionary' using braces '{ }' and 'Key' and 'Value' pairs.
x = { 5 : "Is a Number", "John": "Is a Name", "Python": "Is a Language" }
And initialised to the variable 'x'.
Now, we are supposed to delete the last inserted element. And the last inserted element is,
So, we have used the 'popitem( )' to delete it.
And initialised to the variable 'x'.
And we get the below output,