How to remove all the vowel character from a string?


I am a green hand at programming so I may make so really stupid mistakes.

I want to remove all the vowel character from a string. The below is what I have written.

Instead of returning print “bcdf”, it prints “aeioubcdf”.


n = “aeioubcdf"
def anti_vowel(text):
for i in text:
if i in “aeiouAEIOU”:
text = text.replace(“i”,”")
text = text
return text
print anti_vowel(n)

Can someone please tell me what’s the problem with my code?
Thanks in advance.

<do not remove the three backticks above>


text = text.replace("i","")

consider what is i here?is i a variable or string?


I see. Thank you so much!


btw may I ask to indent in the editor here? This is my first time posting here. I am not so familiar with that


Have a look at this topic it’ll help you to make a good topic :slight_smile:


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