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 trialJackson Myhre
4,550 Pointssquaring
The third line might not be needed to complete this Task but I have no clue what it is I'm missing.
def square(number):
return number * 2
square(5)
Chris Freeman
Treehouse Moderator 68,441 PointsManuel Canario, in input
function can not be used in most challenges because the checker will only call the function directly and will not provide a response to the input prompt. Also be sure the function name matches what is asked for in the challenge. Good luck!!
1 Answer
Chris Freeman
Treehouse Moderator 68,441 PointsYou are doubling the number, not squaring it. To square it use a double asterisk: **
Jackson Myhre
4,550 Pointswow.... I can't believe I made that mistake. Thanks!
Manuel Canario
1,458 PointsWhat about the 0 the computer is saying that I did not validate my program of 0.
Chris Freeman
Treehouse Moderator 68,441 PointsManuel, I suggest starting a new post and include your code. Tag me in the post if you wish.
Manuel Canario
1,458 PointsManuel Canario
1,458 Pointsdef squareanumber(number): squared = int(number) * int(number) print("{} squared is {}".format(number,squared))
number = input("What number would you like to square? ") squareanumber(number)
This was my funtion and the program mark it as an error. I ran it in the workspace and the function is working.