Welcome to the Treehouse Community
Looking to learn something new?
compared each character converted to lower if existed upper then removed vowels
but still not working
def disemvowel(word): for i in word : if (i == 'a' or i == 'e' or i == 'o' or i == 'i' or i == 'u').lower(): word.remove(i) return word
Stuart Wright41,103 Points
There are a few issues with your code:
if (i == 'a' or i == 'e' or i == 'o' or i == 'i' or i == 'u').lower():
You can't call the .lower() method on a whole expression like that. You can only call it on a string.
In the above line you have tried to remove a letter from a string. You can't do this because strings are immutable. Instead of trying to change the string in place, which can't be done, you could maybe create a new blank string at the start of your function and add to it throughout the loop when you have confirmed that each letter isn't a vowel.
Finally, notice the indentation of your return statement. You need to return after the entire loop has completed, not inside it.
Hopefully this is enough to give you some ideas. Let me know if you need any more help.