return zero(count) as value in Python Dictionaries

I have a code which works pretty well if not returning keys with zero counts as values. I am still new to Python, so this may be a matter of a simple tweek, but don’t know how So please how can I return 0 as a value of a key,if there are 0 counts.

def count_types(string):
    dictionary = {}

   for char in string:
        if 'Z' >= char >= 'A':
            dictionary.setdefault("upper", 0)
            dictionary["upper"] += 1
        elif 'z' >= char >= 'a':
            dictionary.setdefault("lower", 0)
            dictionary["lower"] += 1
        elif char == ' ':
            dictionary.setdefault("space", 0)
            dictionary["space"] += 1
        elif '9' >= char >= '0':
            dictionary.setdefault("numeral", 0)
            dictionary["numeral"] += 1
        else:
            dictionary.setdefault("punctuation", 0)
            dictionary["punctuation"] += 1
  return dictionary

print(count_types("aabbccc")) 

Output is:

{'lower': 7}

Desired output is:

{'lower': 7, 'upper': 0, 'punctuation': 0, 'space': 0, 'numeral': 0}

Answer

Try like this. Initialize the dictionary earlier

def count_types(string):
    dictionary = {'lower':0, 'upper':0, 'space':0, 'numeral':0, 'punctuation':0}
    
    for char in string:
        if 'Z' >= char >= 'A':
            dictionary.setdefault("upper", 0)
            dictionary["upper"] += 1
        elif 'z' >= char >= 'a':
            dictionary.setdefault("lower", 0)
            dictionary["lower"] += 1
        elif char == ' ':
            dictionary.setdefault("space", 0)
            dictionary["space"] += 1
        elif '9' >= char >= '0':
            dictionary.setdefault("numeral", 0)
            dictionary["numeral"] += 1
        else:
            dictionary.setdefault("punctuation", 0)
            dictionary["punctuation"] += 1
    return dictionary

print(count_types("aabbccc")) 

output

{'lower': 7, 'upper': 0, 'space': 0, 'numeral': 0, 'punctuation': 0}
>