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 trialHrithik Sharma
6,090 PointsWhat's wrong in my code?
i don't get it i tried this code in my code editor and it worked all the time and it saying "Hmm, got back letters I wasn't expecting! Called disemvowel('OoyMOeF') and expected 'yMF'. Got back None". What does it want
def disemvowel(word):
word = list(word)
vowels = list("aeiouAEIOU")
for vowel in vowels:
try:
word.remove(vowel)
except ValueError:
pass
print("".join(word))
disemvowel("azI")
1 Answer
Steven Parker
231,269 PointsThe instructions say the the function "takes a single word as a parameter and then returns that word at the end.", but right now the code doesn't return anything. And for the purpose of the challenge, you won't need to use "print". So use a "return" instead of "print" for the final result.
Also, the "remove" function only removes the first matching item. If there is more than one of the same vowel in a word, you'll need to remove them all to meet the challenge requirements.