I find with challenging problems it sometimes helps to plug the code into a simulator to see what's happening step-by-step.
I like this one:
So there are two issues I see:
The first is that the argument (text) that is to be entered will be a string, and strings are immutable in Python; in other words, you can't change or remove characters from text. So you can't use
because remove isn't a method for strings.
The second issue is that, as you suspected, there's a problem here:
for char in "text":
if char in "vowels":
because text and vowels are variable names --- they must be text and vowels without quotation marks.
So what can we do? One possibility is this:
vowels = "aeiouAEIOU"
newtext = ""
for char in text:
if char in vowels:
newtext = newtext + char
What we are doing is defining the function anti_vowel to take one argument (text). The function creates an empty string variable (newtext) for holding our non-vowel characters. So as the function looks at the string text, it evaluates each individual character.
If the character is in vowels, it skips it; if the character is not in vowels, it adds it to the newtext string. And finally, at the end, it returns the value of newtext, which is a string without vowels.
I hope that helps!