What is a dictionary
A dictionary ( dict ) stores information as key: value pairs. Instead of accessing the data by its position, as in a list, you…
Dictionaries are the most widely used data structure in real-world Python: they store information by associating a key with a value. In this lesson you will learn how to create, query and modify them, how to loop over them, how to count frequencies and group data, and how to work with nested dictionaries and lists of records. Reinforce your skills with practical exercises such as address books, inventories and word counts.
A dictionary ( dict ) stores information as key: value pairs. Instead of accessing the data by its position, as in a list, you…
There are three ways to loop over a dictionary depending on what you need: only the keys, only the values, or both at once.
Many real problems are solved with three dictionary patterns: counting how many times something appears, grouping elements by a…
The values of a dictionary can be anything, including lists and other dictionaries. This lets you represent structured data, such…
These are the most frequent mistakes when working with dictionaries and how to avoid them.
Create a Python program that stores contacts in a dictionary and looks up the phone number of one of them.
Create a Python program that counts how many times each word of a text appears using a dictionary.
Create a Python program that counts how many times each letter of a text appears.
Create a Python program that finds the character that appears most often in a word.
Create a Python program that calculates the bill of a coffee shop using a dictionary of prices.
Create a Python program that calculates the average grade of each student when the same student can have several grades.
Create a Python program that inverts a dictionary of translations so you can look up in the other direction.
Create a Python program that groups the words of a sentence by their length.
Create a Python program that stores students as dictionaries inside a list and analyzes them.
Create a Python program that writes each digit of a number in words, using a dictionary.