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

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 46,150 Points
  • 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?")
Jacob Hein
Jacob Hein
13,715 Points

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!

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 46,150 Points

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.