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

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

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

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

1 Answer

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 49,649 Points

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