8/15 anti_vowel


#1

Noob here,
I have written my code for this section and it tells me that when putting “Hey look Words!” into my function, it returned “Hy lk Words!”
Can anyone explain the reason it ignored the “o” in “Words”

def anti_vowel(text):
  listed_char = []
  for char in text:
    listed_char.append(char)
  for c in listed_char:
    if c in 'aeiouAEIOU':
      listed_char.remove(c)
  return "".join(listed_char)

#2

I figured it out, it seems there was another post similar to mine on here that I hadn’t seen and that had the answer to my problem.

For anyone that is interested, here is my new function that works:

def anti_vowel(text):
  non_vowel = []
  for char in text:
    if char not in 'aeiouAEIOU':
      non_vowel.append(char)
  return "".join(non_vowel)


#3

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