dict and set types

Dicts hold keys and vals Sets are unordered and free Unique elements

python shell for dict and set types

In Python’s realm, a dict holds keys and values,
Pairs of unique and immutable treasures,
Sets, unordered and free of duplicates,
Allowing operations to manipulate their contents.

In Python, a dictionary (dict) is a collection of key-value pairs, where each key is unique and immutable. This means that I can use the keys to access the corresponding values, and I can also add, remove, and modify key-value pairs in the dictionary. Sets are another type in Python that are similar to lists, but they are unordered and have no duplicate elements. This means that I can use sets to perform operations like union, intersection, and difference between sets, and I can also add and remove elements from the set. It’s important to note that keys in a dictionary must be unique, while elements in a set must be unique.