Anti_vowel


#1

def anti_vowel(text):
    anti=""
    j=0
    for i in text:
        if i not in "aieouAEIOU":
            anti[j]=i
            j+=1

    return anti

I can't seem to understand what is wrong with the above code. I get this error:
Oops, try again. Does your anti_vowel function take exactly one argument (a string)? Your code threw a "'str' object does not support item assignment" error.


Anti_vowel
#2

j is redundant. you don't need it.

to add i (which contains your letters) to anti simply add them (+) to the string


#3

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