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

Anshul Laikar
Anshul Laikar
4,428 Points

why is it showing a tab error

not understanding where i am going wrong

disemvowel.py
def disemvowel(word):
    newword=""
    for letter in word:
        if(letter not in 'aeiou'):
            newword+=letter
    return newword

I've run your code with no problems via Jupyter in VSCode and only receive flake8 warnings about whitespace around your operators. I'd recommend the adding the whitespace around '=' and '+=' unless you're creating an object with parameters such as:

from numpy import ndarray

matrix_3x3 = ndarray((3, 3), dtype=object)

def disemvowel(word):  # I called yapf on your function which would also fix formatting issues 
    newword = ""
    for letter in word:
        if (letter not in 'aeiou'):
            newword += letter
    return newword

Where dtype is optional and defaults to float, but can be modified.

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,457 Points

It's hard to see in the formated text above, but the line newword+=letter is preceded by TABs instead of spaces. Changes these to spaces should remove the error.

Post back if you have more questions. Good luck!!