Anti vowel = Stack overflow answer didn't work - Why not?


Hi. this answer didn't work. Anyone know why not and what needs to be fixed? I'm stuck and I don't just want to copy someone else's answer to get through as I'm not learning anything.

def del_vowel(text):

for i in text:
    if i.lower() in ['a','e','i','o','u']:
return text


Method replace doesn't change the original string. It returns copy of the string with all occurrences of first parameter replaced by second parameter.

This code:


doesn't make any change to the text string. You have to capture result of the method:

text = text.replace(i,"")