the space character appears timesand the uppercase letter appears time this program will work no matter what string is inside the message variableeven if the string is millions of characters longpretty printing if you import the pprint module into your programsyou'll have access to the pprint(and pformat(functions that will "pretty printa dictionary' values this is helpful when you want cleaner display of the items in dictionary than what print(provides modify the previous charactercount py program and save it as prettycharactercount py import pprint message 'it was bright cold day in apriland the clocks were striking thirteen count {for character in messagecount setdefault(character count[charactercount[character pprint pprint(countyou can view the execution of this program at this timewhen the program is runthe output looks much cleanerwith the keys sorted {' ',' ' ' ' ' ' --snip-' ' ' ' ' ' the pprint pprint(function is especially helpful when the dictionary itself contains nested lists or dictionaries if you want to obtain the prettified text as string value instead of displaying it on the screencall pprint pformat(instead these two lines are equivalent to each otherpprint pprint(somedictionaryvalueprint(pprint pformat(somedictionaryvalue)