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 trialMark Bekhet
900 PointsI get a Boomer that I don't understand
When I open the preview to see my mistake and the error type, it says an inconsistence use of spaces and tabs. The problem is my code appears to be fine in my point of view. Thanks for helping
def suggest(product_idea):
return product_idea + "inator"
if len("product_idea") <= 3:
raise ValueError
except ValueError:
3 Answers
Steven Parker
231,248 PointsThat kind of error cannot be "seen". It means that the indentation in the code has been done using spaces and tabs. Python allows you to use either, but only one or the other in any particular file.
You have a few other issues here as well:
- the test and raise must be done before the return
- variable names should never be enclosed in quotes
- the instructions only ask you to raise the exception, you won't need an "except" statement
Kirsten Smith
3,484 PointsFirst off, you are returning a result before the code runs, which means the code won't actually run. The return should always be at the end. You also don't need to have another exception at the end of the code outside of the definition of the function. Lastly, you are passing in product_idea in the len function as a string which does not need to happen.
Mark Bekhet
900 PointsThank you