I'm new to python and having some difficulty troubleshooting my script.
My assignment is to create some function that accepts a list of strings and returns the number of vowels within the entire list.
The game plan I'm attempting to follow is:
- Merge list elements into a single string
- Create a loop that tests if a string element is a vowel
- Use a counter variable to keep track of vowels in string
- Print the value of the counter variable when finished with loop
My code is not elegant, but it also does not work.
def vowelCounter(listName):
new = ''.join(listName)
n = len(new)
count = 0
vowels = 'aeiouAEIOU'
i = 0
for i in range(0,n):
while i < n:
if new[i] in vowels:
count += 1
i += 1
return
print count
return
return
return
print(vowelCounter(["terrapin","station","13points"]))
Please forgive any stupid errors I may have. I will certainly appreciate any help you can offer!