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

Why mi code is not working

Treehouse is telling me t odo a devowel function and i did it but it's telling me Bummer Try again!

disemvowel.py
def disemvowel(word):
    vowels = ["A", "E", "I", "O", "U"]
    for letter in word:
        if letter.upper() in vowels
        word = word.replace(vowel, "")
    return word

2 Answers

Chris Howell
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Chris Howell
Python Web Development Techdegree Graduate 49,702 Points

You are very very close. Take another look at your logic for your replace method. :)

def disemvowel(word):
    vowels = ["A", "E", "I", "O", "U"]
    for letter in word:
        if letter.upper() in vowels:
            word = word.replace(vowels, "") # vowels is a List, but should be the Character you want to replace.
    return word

Thank you i pass the challange :)

Chris Howell
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Chris Howell
Python Web Development Techdegree Graduate 49,702 Points

You have a few errors in there.

def disemvowel(word):
    vowels = ["A", "E", "I", "O", "U"]
    for letter in word:
        if letter.upper() in vowels # <- syntax error, missing :
        word = word.replace(vowel, "") # indentation error and vowel variable doesnt exist.
    return word

i've already fixed it but i still get the bummer try again error!

( fixed: wrapped code snippet in backticks )

def disemvowel(word):
    vowels = ["A", "E", "I", "O", "U"]
    for letter in word:
        if letter.upper() in vowels:
            word = word.replace(vowels, "")
    return word