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

Michael Morale
Michael Morale
2,702 Points

I'm stuck on this.

I know I'm close. But not quite there. Can someone help?

disemvowel.py
def disemvowel(word):
   vowels = ('a', 'e', 'i', 'o', 'u', 'A', 'I', 'E', 'O', 'U')
for char in text:
    if char in vowels:
        text = text.replace(char, '')
   return text

1 Answer

Steven Parker
Steven Parker
229,785 Points

It does look like you're close ... just these issues yet:

  • everything in a function must be indented more than the "def" line
  • indentation at each level needs to be consistent
  • there are several references to "text", but nothing with that name has been defined
  • did you mean to use "word" instead of "text"?