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!

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 Python Basics Functions and Looping Create a Function

subhash w
subhash w
1,143 Points

EOFError when reading a line. can some one help

import math
def square(xyz):
    out = int(xyz * xyz)
    return out

num = float(input("enter a number"))
subhash w
subhash w
1,143 Points

Thanks Kris for the feedback, will take note of the suggestions.

1 Answer

You are doing too much:

  • The error is because the checker is not going to input a value to the input function
  • There is no need to import math
  • You don't need to convert your product to an integer

You will need to do the following:

  • Create a function named square which you have done
  • The function should have a parameter named number (not xyz)
  • return the square which you also have done - just with the wrong parameter name