The Below Python program explains to find / count the frequency of a given character in a string using the string built-in method.
Program :
string = input('Enter the string :')
#Read character input
Char = input('Enter character :')
#initiaalize frequency count to 0
freq_count = 0
#use count function to count frequency of character
freq_count = string.count(Char)
#count function is case sensitive
print(str(freq_count) + ' is the frequency of given character')
Output:
Enter the string :similargeeks
Enter character :i
2 is the frequency of given character
Also Read: