Anti_vowel makes me confuse


its given "string index out of range" error.

why its not woking can somebody help me tof ind out the mistake.

def anti_vowel(text):
    v = "aeiouAEIUO"
    uv= ''
    i = len(text)
    while (i > 0):
        if text[i] not in v:
        i += -1
    print uv
    return uv


lets say i have the following string:


agree with me that the length is 5? Also agree that strings are zero index based so the indexes are:

0, 1, 2, 3 and 4

See how this gives an index error?


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