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 trialAbdul Khan
1,570 PointsChallenge Task 2
What am I doing wrong and can you please explain?
def square(number):
return number * number
result = square(5)
print(result)
4 Answers
KRIS NIKOLAISEN
54,972 PointsYou receive error: AssertionError: 25 != 9 : Make sure you store the return value from the function in a variable named result.
The argument passed in should be 3 not 5. From the instructions:
call your new function and pass it the argument 3
Abdul Khan
1,570 PointsThank you
Paul Nay
566 PointsHello I am wondering why I am getting the incorrect answer. I've tested my code on the workspace to ensure it works.
def square(number): return number ** 2
num_chosen = int(input("Please enter a number to square\n")) result = square(num_chosen)
print("The square of {} is {}".format(num_chosen,result))
KRIS NIKOLAISEN
54,972 PointsPaul, the checker doesn't respond to the input function. For task 1 you just need the function which you have.
def square(number):
return number ** 2
Paul Nay
566 PointsAh thanks for pointing that out. Appreciate the help.