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 trialjordan GERMINARO
281 Pointsplease tell me what im doing wrong
number = int(input("what number would you like to square?"))
im getting an eof error for this line of code and i cant figure out why
3 Answers
<noob />
17,062 PointsCan u post the all code? EOF error means that ur missing a ( or ) at the end of the file this line is fine, u dont get any errors on there
<noob />
17,062 PointsYou have few erros. u define a function named "square" and u didnt call her anywhere. First u need to get input from the user >>> call the function and store the result >> print the result.
def square (number):
return number * number
number = int(input("what number square?"))
result = square(number)
print(result)
jordan GERMINARO
281 Pointsdef square (number): return number*number
number = int(input("what number to square?")) answer = square(number) print ("the square of {} is {}".format(number,answer))
what about this... it still says I have an eof
<noob />
17,062 Pointsdef square (number):
return number * number
number = int(input("what number square?"))
result = square(number)
print("the number is {} and the result is {}".format(number,result))
i runned this code and it works just fine, try it in another workspace maybe?
jordan GERMINARO
281 Pointsjordan GERMINARO
281 Pointsdef square (number): answer = number*number result answer
number = int(input("what number square?"))
print (answer)