As mappable objects, dictionaries have a number of built-in methods, as they cannot use the normal sequence operations (note: d represents a dictionary, key is a particular key for the dictionary, and value is the value associated with a key):
- len(d): This returns the number of items in a dictionary.
- d[key]: This return the value associated with key.
- d[key] = value: This is used to set the mapping of key to value.
- del d[key]: This deletes the value associated with key.
- key in d: If key exists in the dictionary, return True; otherwise, return False.
- key not in d: If key exists in the dictionary, return False; otherwise, return True.
- iter(d): This returns an interator object from the dictionary keys. To actually use the iterated ...