Adding and Removing from Dictionaries in Python


Modify dictionaries by adding or removing items.

Source Code

person["city"] = "New York"  # Add a new key-value pair
del person["age"]            # Remove an item
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments