In this section, you’ll learn more about three types of data structures. You can think of them as ways to organize and store data.
Lists
Lists are used to store sequences of values. They are useful if you want to keep track of the order of the values. The values in the list are called elements or items.
Here are some examples of lists. Notice how lists can store any number of items of any type. Lists can also be empty.
You can use the in keyword to check if an element is contained in a list. The expression will return True if the list contains the element and False otherwise.
Sets
Sets are like lists, but they do not store duplicate entries, and they are unordered (i.e. there is no “first” element in a set).
You can use the in keyword to check if an element is contained in a set. The expression will return True if the set contains the element and False otherwise.
Dictionaries
Dictionaries are useful when you want to store values associated with a particular “key”. For example, if you want to keep track of your friend’s phone numbers, you can use a dictionary.
You can also add or update each key-value pair individually.