Question #326531

7)Write a Python program to count the number of characters (character frequency) in a string. without using function

Expert's answer

string = input("enter string: ")
d = {}
for s in string:
    if s in d:
        d[s] += 1
    else:
        d[s] = 1
print(d)
LATEST TUTORIALS
APPROVED BY CLIENTS