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

Vladimir Lapcevic
Vladimir Lapcevic
6,363 Points

What is the problem with my code? Thanks def suggest(product_idea): product_idea = input("Please suggest some idea")

suggestinator.py
def suggest(product_idea):
    product_idea = input("Please suggest some idea")
    if product_idea(len) < 3:
       raise ValueError("Can you please suggest longer name?")
    return product_idea + "inator"

2 Answers

  • you don't need to prompt for the product_idea as it is passed in to the function as a parameter
  • len(product_idea) instead of product_idea(len)
  • one more indent space in this line: raise ValueError("Can you please suggest longer name?")

Kris,

Could you clarify the last point you made? I'm not understanding why my code won't run for this challenge as it keeps giving me a TabError: inconsistent use of tabs in spaces in indentation.

Thanks!

When I copy paste your code 'raise' was underlined indicating there is a problem with indentation. Your if statement is indented 4 spaces. Raise is only 3 spaces beyond that. It worked this time though.