to count occurrences of a string code example Example: python count character occurrences str1.count("a")