In short
A dictionary stores pairs of a key and a value in curly brackets, such as {"H": 1.008, "C": 12.011}. You look up a value by its key.
The keys must be unique and do not change, for example strings or numbers. To read a value, write masses["C"]. To add or change one, assign to it: masses["O"] = 15.999. A dictionary is the right choice for a lookup table, such as atomic masses, or for counting how many times each item occurs.
This prints 18.015, the molar mass of water in grams per mole.
Python labs run in your browser. Type the code, run it and see what happens.
Open a Python lab