Practice Makes perfect anti_vowel Help!


#1



https://www.codecademy.com/courses/python-intermediate-en-rCQKw/1/2?curriculum_id=4f89dab3d788890003000096


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


#3

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

#4

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


#5

... like what not to do.


#6

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...


#8

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