Write a program in PYTHON that lets the user enter a string
Write a program in PYTHON that lets the user enter a string and displays that appears most frequently in the string using exception handling so that the output is:
Sample run #2:
Solution
string = \"examplexxxll\" dictionary = {} for character in list(string): if character in dictionary: dictionary[character] += 1 else: dictionary[character] = 1 output= [] for key, value in dictionary.items(): output.append((value, key)) for value, key in reversed(sorted(output)): print(\"Character\", key, \"occurred\", value, \"times\")