Your question is Count Character Frequencies. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Iru's message tools need a compact character-frequency summary for analyzing user-entered text. Given a message, count each character and return the results ranked from most frequent to least frequent.
Implement character_frequencies(text, case_sensitive, include_whitespace).
text is a string.case_sensitive is a Boolean. If False, convert alphabetic characters to lowercase before counting.include_whitespace is a Boolean. If False, ignore whitespace characters such as spaces, tabs, and newlines.[character, count].Character comparisons use Python string characters, so punctuation, digits, and Unicode characters are valid inputs.
def character_frequencies(text, case_sensitive, include_whitespace):