Exercise 15, My answer is right but codecademy isnt approving it


#1


https://www.codecademy.com/courses/python-intermediate-en-rCQKw/1/2

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

It should work and it outputs the expected output however, codecademy isnt approving my code

def anti_vowel(text):
    string = ""
    vowelslist = ('a', 'e', 'i', 'o', 'u', 'A', 'E','I','O','U')
    for x in text:
        if x in vowelslist:
            newstr = text.replace(x, "")        
    return newstr


#2

Did you mean to call thie, newstr?

You are not using the replace method correctly. Suggest set it aside and work it out another way. Try,

newstr += x

#3

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