Anti_vowel


#1



Hi,

Stuck on anti_vowel

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


Appears to be working on all but the second "o" of look any guidance anyone can give is most welcome.


def anti_vowel(text):
    
    holder = list(text)
    vowels = ["a", "e", "i", "o", "u"]
    count = 0
    result = ""
    
    for i in holder:
        for a in vowels:
            if a == i.lower():
                del holder[count]
        count += 1
    
    for x in holder:
        result += x
    return result


#2

the problem with del and remove is the index shift that occurs. I would recomment the opposite approach, append constants to a new list/string


#3

Thanks for swift answer that worked perfectly


#4

2 posts were split to a new topic: Anti_vowel


#5