loop break at first. so result is just "H". I don't know why it not work. I think have problem with range. right?

just result is "H"

def anti_vowel(text):
    for i in range(len(text)-1):
        a = text[i]
        if a not in "a"or"e"or"i"or"o"or"u"or"A"or"E"or"I"or"O"or"U":
        else :
        return newtext
anti_vowel ("Hey look Words!")


Don't do that. Just remove it. It has no effect.

The order that is evaluated is:

(a not in "a")or"e"or"i"or"o"or"u"or"A"or"E"or"I"or"O"or"U"

There is nothing there that says to compare the variable a to any of the strings there except "a". That whole condition is equivalent to just True, regardless of what your variable refers to.

If you think there is a problem with the range, (and there is) then print it out to inspect it.

Don't give control back to the caller until you have finished the job


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