Anti_Vowel


#1

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

Error:
Oops, try again. Your function fails on anti_vowel(“Hey look Words!”). It returns “!” when it should return “Hy lk Wrds!”.

I expected it to return the whole thing without vowels instead of just !

```python

def anti_vowel(text):
o = len(text)
b = o - 1
n = ''
for bo in range(0, len(text)):
if text[b] in “aeiouAEIOU”:
b = b - 1

    else:
        n = n + text[b]
        b = b - 1
    return n
<do not remove the three backticks above>

#2

1- Use variables which are more verbose as o, b. bo
2- Use a =print= to see what is happening like print text[b]
3- as you have it now, you are going through your =text= in reverse-order
4- a RETURN will return the result AND exit-the-function
5- the RETURN is within the FOR-loop, so only 1 character is tested
6- do not use tab’s for indentation, use 4 spaces


#3

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