My own dictionary

--Originally published at Welcome to the Heaven

The dictionaries in Python are very similar to a list. The dictionaries can be directly defined or can start in blank and over time you add some values and words or delete some.

The dictionaries write inside keys {} and the values and words with two points:

Example = {"my":12,"first":24,"dictionary":36}

So now with this variable you have already a dictionary and you can call one, two, three or any number of items that you want or change, delete or add one.

down = {“example”:picture}

screen-shot-2016-11-28-at-12-42-56-pmIn the picture you can see how I create a dictionary in white and after I add some values to it.

We can have access to specific items in the dictionary, as you can see in the second print we do it.

If you don’t want to have a KeyError in some key that you do not know if has a value you can use .get that returns None(if the key does not have it), the example of this is the last two prints.

More information? and you want my source?

If you want another different post of the same topic. Is from the blog of one friend.