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 trial

Python Python Collections (2016, retired 2019) Lists Disemvowel

Joshua Emanuel
Joshua Emanuel
3,137 Points

disemvowel Challenge - Not sure where to start?

Not sure where to start with this challenge? Am I meant to convert this to a list or to a for/in function?

disemvowel.py
def disemvowel(word):
    word_list = []
    word_list.extend(word)
    word.join(word_list)







    return word

1 Answer

Yes, you need a for/in function. In this I have the list, and named it vowelslist. And it = all the vowels lowercase, and capitol. Now in the for/in we got: for i in the vowelslist: then we run the if statement: if i (which we defined in the for/in) is in word then word = word.replace the i with '' empty brackets. But this wouldn't work unless we returned the word, which we have at the bottom.

def disemvowel(word):
  vowelslist = ['a','A','e','E','i','I','o','O','u','U']
  for i in vowelslist:
    if i in word:
      word = word.replace(i, '')
  return word
Joshua Emanuel
Joshua Emanuel
3,137 Points

Thanks for your response, I eventually worked it out in a different way but can't find it again to post it here.