Anti vowel


#1

def anti_vowel(text):
str(text)
for i in text:
if i = 'a' or 'e' or 'i' or 'o' or 'u' or 'A' or 'E' or 'I' or 'O' or 'U' :
del(i)
return text

lol i might be newbish, but i thought this would work! but i get anti_vowel global name is not defined ! What do you meen? its a function!


#2

oh and also , can you tel me how to post the text so it show up like in the exercise program ?


#3

@wootpotato

if you want to format your code when you paste it here you have three options

  1. select the code (after you paste it here) and press ctrl + k or
  2. select the code(after you paste it here) and press </> in the tools pane
  3. put this character ` three times at the begining and end of code

#4

        #error lies here in your code
        if i = 'a' or 'e' or 'i' or 'o' or 'u' or 'A' or 'E' or 'I' or 'O' or 'U' :

Remember also strings are immutable(once they are created they are final) and cannot be changed so when you write

del[i]

it does nothing

you can try something like this

def anti_vowel(text):
    text = list(text)
    for i in text:
        if i.lower() in "aeiou":
            text.remove(i)
    return "".join(text)
    
print anti_vowel("main load")