I am getting VERY weird results for exercise 8


#1



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


Instead of the correct output, I get "bcdHy lk Wrds!" (copied directly from the pop up error box). It works when I use the print command and for other inputs, but not "Hey look Words!" I'm honestly at my wits end, and I have no idea what to do next. I even got rid of all 'b's and 'c's in the entire code in case they are somehow screwing me up. I'm that completely out of ideas.

Thanks for your help!


v = 'aeiou'
a = []
s = ''
def anti_vowel(text):
    for n in text:
        if n in v:
            a.append('') 
        else:
            a.append(n)
    return s.join(a)


#2

Why is your function storing data outside of itself? Is it at all desirable to store data between function calls? Shouldn't it start over completely each time it is called?


#3

the errors are due to the variable declarations outside the function


#4

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