A novel solution for 8 / 15 (anti-vowel) which doesn't work for some reason


Hey. I used this code to solve 8 / 15:

def anti_vowel(text):
    c = 0
    temp = []
    final = ""
    for a in text:
    for b in temp:
        if b == "a" or b == "e" or b == "i" or b == "o" or b == "u":
    for c in temp:
        while c < len(temp):
            final += temp[x]
    return final

so I'm taking text, adding the letters on it into a list (temp), and then removing all letters on that list which are vowels [I realise I am missing uppercase vowels]. The second part then adds those letters back into a string. However, when I run this script I get the following error message:

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

What's going on here?


You should make this a little less complex, your code won't work because strings are immutable in python so their value cannot be changed like that.

If you just use the string method join you should get something back, though it still might not be correct.

a = ['a', 'b', 'c']


Here's my short version of the program

def anti_vowel(text):

result = ""
for c in text:
if c not in "aeiouAEIOU":
result += c
return result

print anti_vowel("hoi")