Lesson 17 of 55 · Python
Data Structures – Dictionaries
Duration: 20 minutes
Lesson 17 of 55 · Python
Duration: 20 minutes
python\nperson = {'name': 'Bob', 'age': 25}\nperson['city'] = 'New York'\nprint('Name:', person['name'])\n\n# Iterate over items\nfor key, value in person.items():\n print(key, ':', value)\n\n\nKeys must be hashable (e.g., strings, numbers, tuples). Values can be any object.\n