Not able to code for removing the vowels in 8/15


#1

def anti_vowel(text):
for i in text:
for c in "aeiouAEIOU":
if i == c:
print c
else:
print i


#2

Madhwankakar,

try to define a separate function to test if the letter in the text is a vowel. If it is, then return True, else, return False. Call that function from inside of the anti_vowel(text) function. :wink:

Jaime


#3

def anti_vowel(text):
x= "aeiouAEIOU"
for c in text:
for c in x:
text= text.replace(c,'')
return text

this worked for me


#4

Thank you very much kasianowak, helped me a lot! Only one tiny suggestion: Is it possible there's a quotation mark missing in line 5 of your post?

def anti_vowel(text):
    x = "aeiouAEIOU"
    for c in text:
         for c in x:
            text = text.replace(c,"")
    return text

#5

Another example of code:

def anti_vowel(text):
vowels = "aeiouAEIOU"
new_text = ""
for i in range(len(text)):
k = 0
for j in range(len(vowels)):
if(text[i] == vowels[j]):
k += 1
if(k == 0):
new_text = new_text + text[i]
return new_text