Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Jason Pallone895 Points
I'm literally always getting stuck with these challenges i don't get it... this is what i have so far and i'm lost
def disemvowel(word): vowel = ['a', 'A', 'e', 'E', 'i', 'I', 'o', 'O', 'u', 'U'] for vowel in word: if vowel in word: word.remove(vowel) return word
cb123Courses Plus Student 9,858 Points
The way I completed the challenge
- deconstruct word with list function and assign to list_of_word. This way you can construct your for loop to sound like *for character in list_of_word: *
- Then follow through with conditional logic if character is in the vowels list then continue loop without doing anything. Else use your += to build characters into a new word variable without vowels.
Essentially you are breaking down word into its pieces then rebuilding with the pieces that don't fall out
Hopefully this interpretation helps.
I'm afraid .remove does not work on strings, however you can use .replace to replace the vowels with an empty string. Like this:
would output xampl, replacing the e character with empty strings.