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

I'm getting a tab error and I don't know how to fix it. I'm assuming that I'm branching incorrectly. Help!

I really need some help with this branching concept. I don't know were I should be putting tab. After a colon is an obvious spot, but otherwise, I'm kind of lost.

disemvowel.py
def disemvowel(word):
    return word

disemvowel(word)
vowel = ("a", "e", "i", "o", "u","A", "E", "I", "O", "U")
for vowel in word:
    new_word = word.remove(vowel)

    return new_word

2 Answers

Steven Parker
Steven Parker
231,269 Points

The "return" on the second line ends the function before it gets to the other code. Also, all code inside a function must be indented more than the "def" line.

Also, check your variable usage. The "for" loop currently wipes out your "vowel" tuple and uses it as the loop variable. I'd guess you meant to use it as the iterator instead of the loop variable.

What are some protocols for branching? Do you have a link that I can do my own research into this? Thanks in advance.