Explain dictionary and its characteristics.

Beginner

Answer

Dictionary is a mutable, unordered collection of key-value pairs. Keys must be immutable and unique.

student = {
    "name": "John",
    "age": 25,
    "grades": [85, 90, 78]
}

# Accessing values
print(student["name"])  # John
print(student.get("age"))  # 25

# Adding/updating
student["email"] = "john@email.com"