Answers for "program count the number of occurrences of a letter in a list python"

1

program count the number of occurrences of a letter in a string python

# count the occurence of element in the string
l=input("enter the string")
d={}
print(l)
for i in l:
 if i not in d:
  d[i]=l.count(i)
 else:
  pass
print("Frequency of each element-")

for k in d:
  print(k,"-",d[k])
output:
'''
enter the string14587324569248
14587324569248
Frequency of each element-
1 - 1
4 - 3
5 - 2
8 - 2
7 - 1
3 - 1
2 - 2
6 - 1
9 - 1
'''
Posted by: Guest on February-21-2022
2

python count character occurrences

str1.count("a")
Posted by: Guest on November-16-2020

Code answers related to "program count the number of occurrences of a letter in a list python"

Python Answers by Framework

Browse Popular Code Answers by Language