Anti_vowel


#1

My code is only returning the first letter of the phrase.

Oops, try again. Your function fails on anti_vowel(“Hey look Words!”). It returns “H” when it should return “Hy lk Wrds!”.

vowels = ['A', 'a', 'E', 'e', 'I', 'i', 'O', 'o', 'U', 'u']

def anti_vowel(text):
    result = ""
      
    for char in text:
        if char not in vowels:
            result = result + char
        else:
            return result


#2

We do not need an else branch for this one. After the loop, return your result.


#3

if char not in vowels:
_______ result = result + char
return result


#4

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