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 trialakshaan Mazumdar
997 Pointshow to convert the list back to string?
I am returning the word list . I do not know how to change it back to a single string
def disemvowel(word):
vowels = ['a','A','e','E','i','I','o','O','u','U']
endOList = vowels.index('U')
remvow = 0
wordlist=list(word)
while True :
while True :
try:
wordlist.remove(vowels[remvow])
except ValueError :
break
remvow += 1
if remvow > endOList :
break
return word
2 Answers
Abdishakur Hassan
3,585 PointsHi. You can use JOIN method. In this case
word = "".join(wordlist)
Daniel Schmidt
9,780 PointsTry this:
def disemvowel(word):
vowels = ('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U')
return ''.join([letter for letter in word if letter not in vowels])
If your not familiar with this syntax check out this course Python Comprehensions
akshaan Mazumdar
997 Pointsword = "".join(wordlist) will this work?
Daniel Schmidt
9,780 PointsYes this will work too :)