One Pager Cheat Sheet
- We will learn about dictionaries, a data structure in Python which uses
hashing
to store data inkey-value
pairs, allowing us to categorize data easily. - Dictionaries allow for the storage and retrieval of data in the form of
key-value
pairs, wherekeys
are used asindices
. - Dictionaries in Python are ordered collections of
immutable
key-value pairs, with no duplicate keys allowed. - No, a dictionary cannot have two same keys, but two same values
are allowed
. - Dictionaries have built-in methods for insertion, deletion, and other operations, as well as an
len()
function to get the total length of the dictionary. - The code iterates through the items of a dictionary using
dict.items()
and prints them in the form ofkey, value
, yielding the output "Peter 12". - We learned about different
data structures
, such as variables, lists and dictionaries, to store and manipulate data during the execution of a program.