Dictionaries and Sets
Key-value maps and unordered unique collections.
What you will learn
- Read and write dict keys
- Iterate .items()
- Use sets for uniqueness
python
user = {"id": 1, "email": "dev@example.com"}
user["role"] = "admin"
for key, val in user.items():
print(key, val)
tags = {"python", "api", "python"}
print(tags)Try it yourself
Build a word-frequency dict from a sentence string.
