Python Python Basics Functions and Looping Create a Function

Simon Au
Simon Au
5,508 Points

EOF Error when using input

Currently struggling with this EOF problem. Any guidance would be great!

squaring.py
def square(number):
    return int(number*number)
amount = input('Enter the number')
result = square(amount)

1 Answer

Kevin Esther
Kevin Esther
8,492 Points

Hi Simon,

If you wrap your input request using int() then this returns a number instead of a string.

I done this myself loads of times and you can't see it for looking at it.

I tend to print out my variables and also the type at each stage so I can check if it's a number etc....

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

amount = int(input('Enter the number '))
result = square(amount)
print(result)