python count the number of occurrences in a string programaticly code example Example: python count character occurrences str1.count("a")