Working with Dictionaries In JavaScript, objects are used to store data as key-value pairs. In Python, the equivalent is a dictionary . Dictionaries are extremely flexible and are widely used for representing structured data. Creating Dictionaries JavaScript: Python: 👉 Dictionaries use curly braces with key-value pairs separated by . 👉 Keys are usually strings, but they can also be numbers or other immutable types. Accessing Values 👉 If the key doesn’t exist, this raises an error. To avoid that, use : Adding or Updating Values 👉 Dictionaries are mutable, so you can add or update items easily. Removing Items 👉 removes and returns a value. 👉 deletes a key completely. 👉 empties the dictionary. Iterating Over a Dictionary 👉 Iterating directly gives keys. 👉 returns all values. 👉 returns both keys and values as pairs. Membership Check 👉 The keyword checks for keys , not values. 👉 To check values, use: . Nested Dictionaries 👉 You can nest dictionaries to represent complex data structures. Useful Dictionary Methods Quick Takeaway Dictionaries in Python are like objects in JavaScript. Store key-value pairs with . Access with or safely with . Modify with assignment, remove with or . Use , , and for iteration. Nest dictionaries to represent structured data. Use and for merging and safe access.