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

Why am I getting an EOF error?

Why am I getting an EOF error on line 5, I went to multiple other text editors and they said this code was just fine?

def suggest(product_ideas):
    return product_ideas + "inator"


product_idea = input("what is your idea?\n")
length = len(product_idea)
if length <= 3:
    raise ValueError("that idea is too short")
else:
    print("good idea!")

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,454 Points

Hey Sabeen Azhar, In the product_idea challenge you need to insert your code inside of the provided function. You will not use the input() function since the challenge checker will exercise your code by calling the function. The EOF is caused by the checker being unable to respond to the input statement.

def suggest(product_ideas):
    # your code goes here
    return product_ideas + "inator"

Post back if you need more help. Good luck!!

Even after adjusting my code so that it goes within the function, I still get an EOF at the same line (now line 2)

def suggest(product_idea):
    product_idea = input("what is your idea?\n")
    length = len(product_idea)
    if length <= 3:
        raise ValueError("that idea is too short")
    else:
        print("good idea!")
        return product_idea + "inator"