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 trialJoaquim LM
2,759 PointsEOFError line 20...in the squaring.py, I can not fix it..any suggestion?
import math def square(number): square=number*number return (square)
number= float(input("what is your number for sqr?")) result= square(number) print ("the result of sqr is".format(result))
import math
def square(number):
square=number*number
return (square)
number= float(input("what is your number for sqr?"))
result= square(number)
print ("the result of sqr is".format(result))
3 Answers
Kirsten Smith
3,484 PointsYou don't need parentheses around the return variable, that is only needed if you are printing something out.
Eduardo Valencia
12,444 PointsShouldn't your final line be
print("The result of sqr is {}".format(result))
? You need
{}
as a placeholder.
Chapman Cheng
PHP Development Techdegree Graduate 46,936 Pointsthis works
def square(number):
return number ** 2 #you can put the equation directly in the return line
result = square(3)