Unit 3 Session 1 (Click for link to problem statements)
Understand what the interviewer is asking for by using test cases and questions about the problem.
Plan the solution with appropriate visualizations and pseudocode.
General Idea: Compare each character of the input string to vowels and sum the occurrences.
1) Set a string of vowels to compare to later
2) Set the count of vowels found to 0
3) Loop through the input string
a) If the lowercase version of the character is in the string of vowels, add one to the count
4) Return the count of vowels
def vowel_count(s):
vowels = "aeiou"
count = 0
for char in s:
if char.lower() in vowels:
count += 1
return count