Day 9Most Common Letter

    Mediumstringsdictionaries

    Write most_common_letter(text) that returns the letter that appears most often in text, as a lowercase letter.

    Upper and lower case count as the same letter. Spaces, digits and punctuation are ignored.

    Examples

    Example 1
    >>> most_common_letter("Hello World")
    "l"
    Example 2
    >>> most_common_letter("aabbb")
    "b"

    Good to know

    • If several letters are tied, return the one that comes first in the alphabet.
    • text always contains at least one letter.

    Run examples checks the 2 examples above. Submit runs all 7 tests, including hidden edge cases, and marks the challenge solved.

    solution.py
    Loading Python…

    Test results show up here

    Write most_common_letter in the editor, then run the examples. Use print() freely: its output is shown for each test.