Welcome to the Treehouse Community
Looking to learn something new?
Ive tried disemvowel a few different ways, any tips?
I'm trying to use a function to take all the vowels, capital and lowercase, out of a randomly generated word. I understand that .remove only looks for the first instance, so if there are repeated letters it won't remove them. Any tips?
def disemvowel(word): for letter in word: letter.remove("a", "e", "i", "o", "u", "A", "E", "I", "O", "U") return word
Heather Malloch2,141 Points
I can't remember how I solved this one, probably from a lot of community googeling!
Make a list of vowels first:
Vowels = ['a', 'e', 'i', 'o', 'u']
Its looks like you need to turn your word into a list:
letters = list(word)
Now you need to loop through your word to find vowels, dont forget to letter.lower
Now because your word is a list you can use letters.remove(letter)
Then work out a way of joining the word back together in the return