Dictionaries
are similar to list. They can store many values that can be used when called. The
difference between a dictionary and a list is that every value stored in a
dictionary as mapped to another value.
For
creating a dictionary we use the function dict( ). For stating that something
is dictionary we type the name we want to assign to it followed by the equal
sign. After the equal signs, you start typing the values between curly brackets.
For writing a value it is necessary to type the value, a colon, and the value
it is being mapped to. For separating each set of values we use commas.
As you can
see, when you try to print a dictionary, the values inside of it are printed
without an specific order. For example, if you print them again, the order will
be completely different:
Also, you can get the value is being mapped to another value. Also, you can change the value it is being mapped to:
No hay comentarios:
Publicar un comentario