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 trialChristiian Allen
Courses Plus Student 859 PointsThis is my last question in my basics course.
I have tried just about everything. I don't know why it's not working? If anyone has any last ditch efforts I would appreciate it. Thank you for all the help!
def suggest(product_idea):
return product_idea + "inator"
if len(product_idea) < 3:
2 Answers
Christiian Allen
Courses Plus Student 859 Pointsdef suggest(product_idea): # Check the length if len(product_idea) < 3: # Raise a ValueError if the length is less than 3 raise ValueError # Then return return product_idea + "inator"
Thank you that was it. You were my last run at it and you helped me out. Thank you so much.
Anthony Crespo
Python Web Development Techdegree Student 12,973 PointsYour need to check the length of the product inside the function. And here your if statement don't raise a statement like they want you to.
def suggest(product_idea):
return product_idea + "inator"
if len(product_idea) < 3:
Can you please raise a ValueError if the product_idea is less than 3 characters long? product_idea is a string. Thanks in advance!
def suggest(product_idea):
# Check the length
if len(product_idea) < 3:
# Raise a ValueError if the length is less than 3
raise ValueError
# Then return
return product_idea + "inator"
Anthony Crespo
Python Web Development Techdegree Student 12,973 PointsAnthony Crespo
Python Web Development Techdegree Student 12,973 PointsNo problem!