Header Ads Widget

Program to count the frequency of each letters in a sentence in Python

Program to count the frequency of each letters in a sentence in Python :-


code:-


def word_counter(s):
c={}
for i in s:
c[i]=s.count(i)
return c
name=input("Enter your name : ")
print(word_counter(name))


Output:-


Enter your name : easycodingzone
{'e': 2, 'a': 1, 's': 1, 'y': 1, 'c' 1, 'o': 2, 'd': 1, 'i': 1, 'n': 2, 'g': 1, 'z': 1}



Recommended Post:-

codechef problems:-

Wipro :-

Infytq :-

Key Points;-

Hackerrank:-


C-tutorial:-

See more:-