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
>>>
There is a error in the program plss check
ReplyDeletePlease copy the program carefully and run in your python script mode .
DeleteCan we do by loop
ReplyDeleteYes..
Deletethanks
ReplyDeleteWelcome : )
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )