Question #326282

Write a python program to count number of each characters in a string


For example python


P=1,y=1,t=1,h=1,o=1,n=1

Expert's answer

inputString=input("Enter a string: ")
freq = {}
  
for i in inputString:
    if i in freq:
        freq[i] += 1
    else:
        freq[i] = 1
  
print (str(freq))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS