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

Michael Revy
Michael Revy
3,882 Points


I get Bummer! Hmm, got letters did not expect - or similar.
I loop thru vowel list and while I can find vowels in the word, I remove, then on to next vowel. I also force lowercase.

def disemvowel(word):
    disem = list(word.lower())
    vowels = ["a", "e", "i", "o", "u"]

    for i in range(len(vowels)):
        while True:
            except ValueError:

    return ''.join([i for i in disem])

word = "CaaaPgZZUUiRfseEYooOj"
cipher = disemvowel(word)
Michael Revy
Michael Revy
3,882 Points

I entered a very elegant solution (not my own - Brandon Jaus)

def disemvowelb(word): return ''.join([i for i in word.lower() if not i in 'aeiou'])

but this still gives me the Bummer! I tested with several long words and seemed to work fine.

Michael Revy
Michael Revy
3,882 Points

I see my mistake .. I should not lower case any consonants !!! Removed lower and added uppercase vowels

Help man me with full working code I'm stack man its been days please help!!!

1 Answer

Stuart Wright
Stuart Wright
41,118 Points

I have amended the one line solution you've posted a little to get the correct solution:

def disemvowel(word):
    return ''.join([i for i in word if not i in 'aeiouAEIOU'])

Can yu help me with full working code please!!