Dictionaries · 9 / 15 Exercise Medium

Most frequent character

Objective

Create a Python program that finds the character that appears most often in a word.

Instructions

  • Read a lower-case word, without spaces.
  • Count the appearances of each character with a dictionary.
  • Show Most frequent: C (K), where C is the character and K the number of times it appears.
  • If several characters tie for the maximum, show the one that comes first alphabetically.
Input
banana
Output
Most frequent: a (3)

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise