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! While you're at it, check out some resources Treehouse students have shared here.
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 trialOwen Wherry
1,508 PointsOn this code challenge, how do you make it so that the vowels are removed exactly as many times as necessary?
I made sure on my previous attempts to format word using .upper() and create it into a list, but am still struggling on how to remove vowels as many times as there are vowels. Thank you in advance for your help!
def disemvowel(word):
return word
1 Answer
Steven Parker
231,275 PointsYou could convert the word into a list and then use a loop to remove the letters one at a time, and judging from other forum questions that's a popular solution method. Such a solution could contain an inner loop that would use the membership operator ("in") to run as long as the letter(s) are present.
But another strategy is to work with strings directly, and make use of the string "replace" method. It automatically handles every instance of a target letter in one operation.
Owen Wherry
1,508 PointsOwen Wherry
1,508 PointsThanks for the help Steven!