Q. Write a program to count the number of times a character occurs in the given string.


Answer = 


string = input("Enter a string :-")
for i in string :
      print(i, "=", string.count(i), "times")


Output :-

Enter a string :-Path Walla
P = 1 times
a = 3 times
t = 1 times
h = 1 times
  = 1 times
W = 1 times
a = 3 times
l = 2 times
l = 2 times
a = 3 times

>>>

6 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post