Python Program to Count the Number of Occurrences of a Character in a String Using count() Function
# Count the Number of Occurrences of a Character in String Using method count() in Python
my_string = "Hello"
my_char = "l"
print(my_string.count(my_char))
Output
2
About The Author
I have more than 6 years of experience in the IT industry, and I have built a solid foundation in the creation and upkeep of online applications. I have constantly shown strong work ethics, self-motivation, and an aptitude for learning quickly throughout my career.