Welcome to the Treehouse Community
Looking to learn something new?
remove list item
i am not able to remove word from list
def disemvowel(word): L = ["a", "e", "i", "o","u"] for N in L: av = list(word.lower()) for M in av: if M == N: av.remove(M) world = str(av) return word
Steven Parker221,297 Points
Never remove items inside a loop from the iterable that is controlling the loop. This can case side-effects such as items being skipped over. Instead, you could iterate using a copy of the iterable (easily made with a slice), or you could create a new result in the loop and return that.
Also, don't convert the entire word to lower case. This will potentially modify some of the letters that you intend to keep (they should remain unchanged).
I don't think you can use "str" to convert a list into a string, but you can do it with "join".
And check your variable names. The code creates "world" but returns "word" (which is the original argument unchanged).