Anti_vowel


#1

def anti_vowel(text):
    new_str = text
    vow     = ("a","e","i","o","u","A","E","I","O","U")
    for x in text:
        if x in vow:
            new_str = text.replace (x, "")
    return new_str

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

Please help if you can?


#2

text stays unaffected. This means, first e is removed:

Hy look words

then o is removed, but from text (which still contains hey look words

Hey look words

you need to replace and store the result in the same variable so you replace from updated string


#3

Can you push me here, I dont get any way to store the new_str, which can replace the updated string


#4

You can write:
new_str=" " and later add new_str+=x in the else condition


#5

we have a string stored in a variable

we can execute a .replace() action on a string, and store the result of this replace action in the same variable


#6

You're doing just one mistake there...

new_str = text.replace (x, "")
hint**
if you replace something in this line of code it'll work fine.

Another thing...
You could have done it without using if statement, just using tuple vow.


#7

Got You, it worked. Thank You


#8

I get it done. Thank You


#9