python array setdefault increament value code example Example: python one line key increment or add my_dict[key] = my_dict.get(key, 0) + 1