Anti_vowel big letters


#1

Hello!
Can somebody tell me why this code doesn’t work properly in codecademy (although it works as it should in MS VisualStudio):

def antiVowel(text):
    newText = ""
    for letter in text:
        if letter.lower() == "a" or letter.lower() == "o" or letter.lower() == "i" or letter.lower() == "e" or letter.lower() == "u":
            continue
        else:
            newText = newText + letter
    return newText

It gives me error: Your function fails on anti_vowel(“Hey look Words!”). It returns “hy lk wrds!” when it should return “Hy lk Wrds!”.
But in MS VS it returns correct cases.
Thanks in advance.


#2

Codecademy’s tests aren’t executed when you run it on your own computer, not failing tests doesn’t necessarily mean that you passed them, it can also mean that you didn’t run them at all

Either way, other people can’t try your code because you posted something different, something that won’t run anywhere. Make sure code that you post is kept intact (use the buttons in the post editor)

You’re only using VS as a code editor, the program actually running the code is something else (likely cpython 3.5, 3.6, or 2.7), but again, the difference here is almost certainly in how you’re running the code and how you’re testing it


#3

Sorry, i forgot to write that I set variable text as “Hey look Words!”.
But I don’t get why it doesn’t work in codecademy, while it works in VS while having the same input as text…
Anyways, thanks for you answer.
PS. Actually, the topic is out-of-date, because it MAGICALY started working without changing a line in a code, after refreshing a browser… probably it’s problem on my side with browser?


#4

I’m quite certain that you changed something that you didn’t think mattered or without paying attention to the change. The error message that you got shows a slightly wrong result. If you compare the names in the error message and your function, you can tell that codecademy wasn’t running the code that you posted at all, it ran something else which you had probably entered earlier. And then you had to have changed your code to the right name, or you’d simply get told that the function was missing.

“works for me” is just saying it’s being used differently! So then one would need to start arguing for why the way it’s used is correct right? Starting with what the code is, and what code was used to test it


#5

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