# Example: Representing a user profile with multiple addresses and roles user_profile_data = { "id": "usr_123", "username": "johndoe", "email": "john.doe@example.com", "is_active": True, "roles": ["admin", "editor"], "addresses": [ { "type": "shipping", "street": "123 Main St", "city": "Anytown", "zip": "12345" }, { "type": "billing", "street": "456 Oak Ave", "city": "Otherville", "zip": "67890" } ], "preferences": { "newsletter": True, "theme": "dark", "notifications": ["email", "sms"] } } print("User ID:", user_profile_data["id"]) print("Email:", user_profile_data.get("email", "N/A")) print("First Role:", user_profile_data["roles"][0]) # Accessing nested list of dictionaries for address in user_profile_data["addresses"]: if address["type"] == "shipping": print(f"Shipping Address: {address['street']}, {address['city']}") # Accessing nested dictionary print("Preferred Theme:", user_profile_data["preferences"]["theme"]) # Adding a new role user_profile_data["roles"].append("viewer") print("Updated Roles:", user_profile_data["roles"]) # Adding a new preference user_profile_data["preferences"]["language"] = "en-US" print("Updated Preferences:", user_profile_data["preferences"])