# (Default)Dict ## Dict ```python= my_dict: dict[str, int] = dict() my_dict["hallo"] = 2 my_dict.pop("falscherKey") ## raise KeyError my_dict.pop("falscherKey", None) ## return None my_dict.get("hallo", None) ## return 2 my_dict.pop("hallo", None) ## return 2 and remove "hallo",2 from dict for name, value in my_dict.items(): pass ``` ## Defaultdict ```python= from collections import defaultdict my_dict: defaultdict[str, int] = defaultdict(int) my_dict["hallo"] += 2 ## doesn't find "hallo", create "hallo" with 0 and add 2 ```
