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

Hasan Basri Tosun
Hasan Basri Tosun
5,228 Points

cannot see what is the problem here

When I run the code in pycharm, I can remove all the vowels, however in the challenge I get the error message " got back letters I wasnt expecting"

Thanks for the help.

disemvowel.py
def disemvowel(word):

    removal = list(word)
    vowel = ["a", "e", "i", "o", "u", "A","E","I","O","U"]

    i = 0
    while i< len(vowel) :
        i +=1
        for k in word:
            if k == vowel[i-1]:
                removal.remove(k)

    del vowel[i-1]

    word = "".join(removal)

    print(word)

1 Answer