Python

Loop through a dictionary

Aug 8,97

Just like you can do it with lists, you can use a for loop to loop through a dictionary. To …

Read More

Delete a key-value pair in a dictionary

Aug 8,97

It is really easy to remove a key-value pair from a dictionary – you only need to specify the key …

Read More

Modify a value in a dictionary

Aug 8,97

To modify an existing value in a dictionary, we simply need to assign the new value to the key. Consider …

Read More

Add new key-value pair to a dictionary

Aug 8,97

To add a new key-value pair to a dictionary, we can use the following syntax: my_dict = {'eye_color': 'blue', 'height': …

Read More

What are dictionaries?

Aug 8,97

Dictionaries (also known as mappings) are used in Python to store a set of objects by key, so you can …

Read More

What are sets?

Aug 7,97

Sets are collections of items, that, unlike lists, can’t have any duplicates in them. They are defined inside curly braces, …

Read More
Geek University 2022