Anti_vowel makes me confuse


#1



https://www.codecademy.com/courses/python-intermediate-en-rCQKw/1/2?curriculum_id=4f89dab3d788890003000096#


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:
          uv.append(text[i])
        i += -1
    print uv
    return uv


#2

lets say i have the following string:

"hello"

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?


#3

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