###### Rachel Layman

**Python Web Development**Techdegree Student 374 Points

# Need Help Understanding the Error in this Function

I have been stuck on this exercise for a couple of days and just really want to move on. I keep tinkering with this function, and I truly cannot understand why this isn't working! I keep getting an EOF error, which has something to do with redirecting input back in to the function, I guess. Can anyone please help me understand why this isn't working?

def square (number): return number * number

number = int(input("What is the number? ")) print("The square of your number is {}".format(square))

```
def square (number):
return number * number
number = int(input("What is the number? "))
print("The square of your number is {}".format(square))
So, no matter what input number I used when I run the function, the response I get back is exactly this:
The square of your number is <function square at 0x7f7fade45e18>
I am stumped....
```

## 5 Answers

###### Dave StSomeWhere

19,779 PointsWell you defined the function like:

```
def square (number):
return number * number
```

It is expecting 1 parameter - you call it number

So, when you call your function - you need to pass a parameter like:

```
print("The square of your number is {}".format(square(number)))
```

You should probably review the video again regarding defining and calling functions

###### Dave StSomeWhere

19,779 PointsTry passing `number`

to the `square()`

function

###### Rachel Layman

**Python Web Development**Techdegree Student 374 Points

It......does....make sense. But the abstraction is melting my brain right now. I need to get in some more practice! I really appreciate you taking the time to help me understand that piece!

###### Rachel Layman

**Python Web Development**Techdegree Student 374 Points

Hmm, ok, so how would that look in practice?

###### Rachel Layman

**Python Web Development**Techdegree Student 374 Points

Ok, great, that did work! I guess I will need to review the video (already rewatched the last 2 on functions about 5 times each!)

What confuses me, is that I thought I had asked it to return the square of my input in the function, where I asked "square" to return number*number (my input number multiplied by itself.)

###### Dave StSomeWhere

19,779 PointsYes, I can see your confusion. Your function accepts 1 parameter and then returns the square (number * number).

You're input and print is outside the function (hence the purpose of functions being reusable).

So, once you have the number you wish to have squared - you call your function to square it. So you need to pass the argument so the function knows what value to do it's stuff on.

Also, that's why function calls always have the parenthesis like square(). There can be 0 to many parameters defined for a function.

Hope that clears it up a bit