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

Igor Bochenek
Igor Bochenek
3,960 Points

disemvowel

I can't figure out what is wrong in this code

disemvowel.py
def disemvowel(word):
    vowels = ["a", "e", "i", "o", "u"]
    empty_space = ""
    for letter in word:
        if letter not in vowels:
            empty_space += letter
        print(empty_space)
    return(word)

2 Answers

Umesh Ravji
Umesh Ravji
42,386 Points

Hi Ignor, your just about there, only minor issues. It might help if your empty_space variable was named differently, such as new_string or anything else you can think of. Not sure what the print statement is in there for, I just removed it :)

def disemvowel(word):
    vowels = ["a", "e", "i", "o", "u", "A", "E", "I", "O", "U"] # remember to include upper case too
    empty_space = ""
    for letter in word:
        if letter not in vowels:
            empty_space += letter
    return empty_space # return the string you are bulding up, not the original word
Igor Bochenek
Igor Bochenek
3,960 Points

Thank you for help i think the prblem was in that , i forgot about uppercase letters