Sets and dictionaries
6. Sets and dictionaries#
After finishing with lists and tuples, now it is the turn of the two other built-in iterable data-types in Python: sets and dictionaries. As we will see, they are collections of values that are useful in different situations.
Chapter Summary
Sets:
creating a set
adding elements in a set
removing elements from a set
searching for a value in a set
set comparison
set comprehension
set operators
frozensets
Dictionaries:
create a dictionary
add/remove/update key-value pairs
access key-value pairs
search dictionaries
update() method
dictionary comprehension
compare dictionaries
copy dictionaries