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 Basics Functions and Looping Raise an Exception

Why isn't this working?

It keeps saying: File "task_one.py", line 5
return product_idea + "inator"
^
TabError: inconsistent use of tabs and spaces in indentation

suggestinator.py
def suggest(product_idea):
    numberOfCharacters = len(product_idea)
    if numberOfCharacters < 3:
        raise ValueError("Your product's name has to be a minimum of 3 characters long")
    return product_idea + "inator"

try:
    productIdea = str(input("What would you like to call your idea?      "))
except ValueError as err:
    print("Oh no! Something has gone wrong!")
    print("({})".format(err))

1 Answer

Tristan Magpantay
seal-mask
.a{fill-rule:evenodd;}techdegree
Tristan Magpantay
Full Stack JavaScript Techdegree Student 14,032 Points

This happens sometimes. Just delete the tabulations and new line before your code in line 5 and then put your line of code back where it's supposed to be.