Here is my code. I\'m not exactly sure if I need a counter for this to work. The answer should be \'iiii\'
.
def eliminate_consonants(x):
==
tests for equality. You are looking to see if any of the characters exist in the string that are in your list 'vowels'. To do that, you can simply use in
such as below.
Additionally, I see you have a 'vowels_found' variable but are not utilizing it. Below one example how you can solve this:
def eliminate_consonants(x):
vowels= ['a','e','i','o','u']
vowels_found = 0
for char in x:
if char in vowels:
print(char)
vowels_found += 1
print "There are", vowels_found, "vowels in", x
eliminate_consonants('mississippi')
Your output would then be:
i
i
i
i
There are 4 vowels in mississippi