Every line of 'python program to count the number of vowels in a string' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
1 def count_letters(string): 2 freq, limit, i = {}, len(string), 0 3 while i < limit: 4 if string[i] in freq: 5 freq[string[i]] += 1 6 else: 7 freq[string[i]] = 1 8 i += 1 9 return freq
12 def char_count(w): 13 num = 0 14 for i in xrange(len(w)): 15 if re.search(r'[a-zA-Z]', w[i]): 16 num += 1 17 return num