Python 3 Script to Count Repeated Occurrences of a Character in a String

Python 3 Script to Count Repeated Occurrences of a Character in a String

Python 3 Script to Count Repeated Occurrences of a Character in a String

chars = "abcdefghijklmnopqrstuvwxyz"
check_string = "i am checking this string to see how many times each character appears"

for char in chars:
  count = check_string.count(char)
  if count > 1:
    print(char, count)
Share on:

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Comment