Python Program to Count the Number of Occurrence of a Character in String ( Using method count())

bookmark

my_string = "Programiz"
my_char = "r"

print(my_string.count(my_char))

 

Output

2