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

I thought srings were immutable?

I dont get this, i thought strings were immutable. How does it want me to remove anything from it? I tried append each letter from the word into a list, but i couldent figure out how to do that. Halp?

disemvowel.py
def disemvowel(word):
    word
    return word

1 Answer

Steven Parker
Steven Parker
229,732 Points

You're right, strings are immutable. So in your function, you'll probably want to create a new string that has all the letters of the old one except the vowels, and then return that.

You could use a list but you could also build a string using concatenation.

Can you elaborate, what do you mean "buildi a string using concatination".

Steven Parker
Steven Parker
229,732 Points

Here's an example of a loop building a new word from the letters of an old word (without any changes):

newword = ""
for ltr in oldword:
    newword += ltr