Dictionaries store data in key:value pairs — like a real dictionary (word → definition).
Very useful in ML for storing hyperparameters, model configs, or data mappings.
student = {
"name": "Alex",
"age": 22,
"grade": "A",
"skills": ["Python", "ML"]
}
print(student["name"]) # Alex
Keys must be unique and immutable (strings, numbers, tuples).
.get(key, default) — safe access.keys() / .values() / .items().update(other_dict).pop(key).clear()Example:
model = {"type": "CNN", "layers": 5}
model.get("optimizer", "Adam") # Adam (default if missing)