Write a python program to print most frequent letter in a string

Write a python program to print most frequent letter in a string

Program
def myfun():
    a = 'sateesh'
    most_frequent = max(a, key = a.count)
    print("The most frequent letter is : ",most_frequent)
                 
if __name__=="__main__":
    myfun()


Output:

The most frequent letter is : s


Program
Python Program to Count the Occurrences of Each Character
import collections
def myfun():
    a = 'sateesh'
    print(collections.Counter(a).most_common(len(a)))
                 
if __name__=="__main__":
    myfun()



Output:

[('s', 2), ('e', 2), ('a', 1), ('t', 1), ('h', 1)]



More Questions


47 . Write a python program to print most frequent letter in a string
48 . Write a python program to check memory sizes of list ,set ,tuple
49 . How do you confirm if an object is iterable using code?
50 . Write a python program to sort list with sorted & lambda
51 . Write a python program to access news using python
52 . Write a python program to print lowercase names
53 . Write a python program to Find Index Using Enumerate
54 . Write a python program to checking if a string is empty or not ?
55 . Write a python program to merge nested lists ?
56 . Write a python program to Checking if a File Exists or Not ?
57 . Write a python program to convert uppercase strings and we want to convert them into lowercase strings and remove duplicates ?



For latest job updates join Telegram Channel: https://t.me/sateeshm