8. anti_vowel help



Oops, try again. Your function fails on anti_vowel("Hey look Words!"). It returns "Hey look Words!" when it should return "Hy lk Wrds!".

It should be returning new[] but with all of the consonants joined together, but it's only print out "Hey Yo!"

def anti_vowel(text):
    vowels = ['A','a','E','e','I','i','O','o','U','u']
    new = []
    s = ""
    for char in text:
        for c in vowels:
            if c == 'u' and c != char:
    return s.join(new)
print anti_vowel("Hey You!")


Hi ,
Just had a quick look at your code.
1) for c in vowels: ----> You are checking the condition, so use "if not in "
in the place of for loop and
also when not found in the vowels list, try to append.
2) if c == 'u' and c != char: This line is not necessary.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.