Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python

Bryce Brown
Bryce Brown
218 Points

Squaring Challenge EOF in quiz but works in the workspace.

I have been rewriting and revising the code just in case the way I had done it just was not being picked up by the quiz but all of them return an EOF error.

def square(number): return number * number

number= int(input("number to be rounded?")) number= int(number) number= square(number) print ("the result is {}".format(number))

What am I doing wrong? Thanks for the help!

1 Answer

Mel Rumsey
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree seal-36
Mel Rumsey
Treehouse Staff

Hey Bryce Brown! I am not too sure what challenge this is in reference to but I did find this challenge that is to create a squaring function. If this is not the challenge you are referencing please share the link so that we can help you with it.

For this challenge, it looks like you are on the 2nd objective as you have already properly written out the function:

def square(number): 
    return number * number

The 2nd part is asking you to do the following:

Under the function definition, call your new function and pass it the argument 3. Since your square function returns a value, create a new variable named result to store the value from the function call.

Your code does work, but it is not doing what the challenge is asking. It's asking you to call the function and pass in the number 3 and save the returned value to a variable named result.

Again, if this is not the challenge you are referencing please provide a link so that I can best help you out. ^-^