Practice Makes perfect anti_vowel Help!


Ok my algorithm works well in this challenge. I want to know if there is any other method without using the replace method. Thanks. I want to know to expand my knowledge.

def anti_vowel(text):
    vowels = ['A','a','E','e','I','i','O','o','U','u']
    for vowel in vowels:
        if vowel in text:
            text = text.replace(vowel, "")
    print text    
    return text


I don't know if this helps, considering it also uses the .replace() method, but I do think that it is different enough for you to learn something from:

def anti_vowel(text):
    for each in str(text):
        if each in "aeiouAEIOU":
            text = text.replace(each, "")
    return text


Thanks! it gives me a more perspective on what different things i can do.


... like what not to do.


What are you talking about? The code I provided, works perfectly fine. I was merely showcasing an alternative method (which is what @arcplayer88793 wanted examples of). I'm not quite sure what you are referring to...


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