Please tell me what is wrong with my code


This is to remove all the vowels. First i convert the input to a list and the remove a character if it happens to be a vowel. The error says:
Oops, try again. Your function fails on anti_vowel("Hey look Words!"). It returns "['H', 'y', ' ', 'l', 'k', ' ', 'W', 'o', 'r', 'd', 's', '!']" when it should return "Hy lk Wrds!".
Which is why I use the join() function. But that isn't working.

 def anti_vowel(text):
    for a in text:
    for c in new:
        for x in 'aeiouAEIOU':
            if x==c:
    return new


you don't store the result of the join action in a variable? so you join, but don't save this anywhere.

also, remove() is a difficult approach given you deal with index shifts which causes problems if you have successive vowels.


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