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 trialDenny Ho
4,472 Pointsmy script works, except after each disemvoweled word, it also outputs a None in my list. Please help me understand why?
def disemvowel(blah):
vowels = list('aeiou')
brk = list(blah)
for vowel in vowels:
while vowel in brk:
try:
brk.remove(vowel)
except ValueError:
break
s=''
print(s.join(brk))
tests = ['mississippi', 'alabama', 'arkansas']
for words in tests:
print(disemvowel(words))
1 Answer
akak
29,445 PointsYou're not returning anything from the function. The first word that is printed is because you print it in the function, while your print(disemvowel(words)) prints none since nothing is returned. Change print(s.join(brk)) to
s=''
return s.join(brk)
and all should be good :)
Denny Ho
4,472 PointsDenny Ho
4,472 Pointsthat makes obvious sense now that you mention it. thanks!