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!
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
Daniel D'luyz2,880 Points
This editor does not check correctly the answer
I've tried 3 different solutions and they all work on the workspace, but this editor keeps telling me that the string I am returning contains the vowels.
This is the last solution I tried checking:
to_remove = ["a","A","e","E","i","I","o","O","u","U"] def disemvowel(word): while len(to_remove) > 0: letter = to_remove word = word.replace(letter, '') to_remove.remove(letter) return word
And before that:
to_remove = ["a","A","e","E","i","I","o","O","u","U"] def disemvowel(word): word_list = list(word) while len(to_remove) > 0: letter = to_remove while True: try: word_list.remove(letter) except ValueError: to_remove.remove(letter) break return ''.join(word_list)
Jennifer NordellTreehouse Teacher
Hi there, Daniel D'luyz ! You're doing terrific and your logic is pretty solid. However, you haven't taken into account what happens when your
disemvowel function is run more than once. Because you declared the list holding the vowels outside`of the function, once the function completes that list is no longer filled with vowels. It is, in fact, empty. So the second time that function is run, the vowels will not be removed.
To mitigate this, you can place the declaration of the
to_remove list as the first line inside your function. That way, every time the function is run, the vowel list will be reset.
Hope this helps!