Method to get a list of all keys in a dictionary
.keys() (returns a view object)
Method to get a list of all values in a dictionary
.values() (returns a view object)
Method to get a list of (key, value) tuples
.items() (returns a view object)
Method to remove a key-value pair using the key and return its value
.pop(key, [default])
Method to remove and return an arbitrary (random) key-value pair
.popitem()
Method to clear all key-value pairs from the dictionary
.clear()
Method to get the value for a given key, or a default value if the key is not found
.get(key, [default])
Method to insert key-value pairs from another dictionary or iterable into the current dictionary
.update(other_dict)
Method to return a new dictionary with specified keys and a default value for each
.fromkeys(iterable, [value])
Method to insert a key with a value if the key does not already exist
.setdefault(key, [default_value])
What is the time complexity for looking up a key in a Python dictionary?
O(1) (Constant time)