Episode 14 of 29
Dictionaries
Learn about Python dictionaries — key-value pairs for storing structured data.
Dictionaries store data as key-value pairs.
Creating Dictionaries
person = {
"name": "Alice",
"age": 30,
"city": "Mumbai"
}
print(person["name"]) # AliceCommon Operations
person["email"] = "alice@example.com"
person["age"] = 31
del person["city"]
if "name" in person:
print("Name found!")Looping
for key, value in person.items():
print(key + ":", str(value))