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

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

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. ^-^