Welcome to the Treehouse Community
Looking to learn something new?
Morten Egge1,898 Points
Error on disemvowel
keep getting error on my code, it works in console..
def disemvowel(word): vowel = 'AEIOU' mod_word = "" for i, v in enumerate(word.upper()): if not v in vowel: mod_word += v return mod_word
Michael Hulet47,842 Points
In this case, it's a casing issue. The word you return needs to match the case of the word that's passed in. For example, if the function takes the string
"no vowels", it expects to get back
"n vwls", not
"N VWLS". At the beginning of your loop, you're converting the entire word to be uppercase, so when you build
mod_word, all the letters will be unconditionally capital. It'd be better if you converted each individual letter to uppercase when you check to see if it's a vowel instead. That way, you can still keep a list of just the uppercase values, and you still have access to the properly-cased value to append to