Anty Vowels


Why does not my Code work , I keep getting an error with index ? anyone please explain what should I do or what is the error so I can work a way ?

def anti_vowel(text):
    #" " join.(list) For making a list into a string
    for i in range(0 , len(text)):
    for e in range(0,len(String)):
        for String[e] in Vowels:
            del String[e]
    return "".join(String)

Replace this line with your code.


I feel as if you took it too far.. its actually fairly simple.
Here's how I did it:

def anti_vowel(text):
    removal = "" #empty string.
    vowels = ['a','e','i','o','u','A','E','I','O','U'] #list of vowels.
    for i in text: #iterates over every letter in the string.
        if i not in vowels: #If its not in the vowels in list.
            removal = removal + i #add it to the removal string
    return removal

print anti_vowel('Hey there! how you doing?') #test

Hope this helps out with your confusion :slight_smile:


Thanks alot for your help :slight_smile:


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