
Julian Eysmont
496 Pointshow to count characters in strings?
def suggest(product_idea):
if product_idea < len(3)
raise ValueError("The name is too short")
return product_idea + "inator"
1 Answer

Jennifer Nordell
Treehouse TeacherHi there, Julian Eysmont! Counting the number of characters in a string is fairly straightforward. If you pass in the string to the len()
function, it will return the number of characters. For instance:
name = "Julian"
print(len(name))
This will print out the number 6 because there are 6 characters in "Julian". I think what you're meaning to do is ask:
if len(product_idea) < 3:
Hope this helps!