Nov 17, 2024
{}
with key-value pairs separated by colons.{ "name": "John", "age": 30 }
.dictionary[key]
.dict.get(key)
method avoids errors if the key is missing.dictionary[key] = value
..keys()
: Returns all keys as a list..values()
: Returns all values..items()
: Returns items as key-value tuples..update()
: Adds new key-value pairs.type(dictionary)
returns dict
.{}
or set()
function..add()
to add and .remove()
to remove.set()
function..clear()
: Empties the set..pop()
: Removes a random element.union()
: Combines unique elements from two sets.intersection()
: Finds common elements."table": ["piece of furniture", "list of facts"]
.9
and 9.0
separately using strings or tuples for differentiation.