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 trialMichael Revy
3,882 Pointsdisemvowel
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:
try:
disem.remove(vowels[i])
except ValueError:
break
return ''.join([i for i in disem])
word = "CaaaPgZZUUiRfseEYooOj"
cipher = disemvowel(word)
print(word)
print(cipher)
Michael Revy
3,882 PointsI see my mistake .. I should not lower case any consonants !!! Removed lower and added uppercase vowels
Perfect Tinotenda Mashingaidze
5,070 PointsHelp man me with full working code I'm stack man its been days please help!!!
1 Answer
Stuart Wright
41,120 PointsI 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'])
Perfect Tinotenda Mashingaidze
5,070 PointsCan yu help me with full working code please!!
Michael Revy
3,882 PointsMichael Revy
3,882 PointsI 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.