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 trialJoseph Cook
195 PointsMy code works fine in the workspace, but It is not working on this challenge task, please help.
I copy and pasted my code from workspace to the challenge task, but there is a error on line 4 in the challenge task.
def square(number):
return (number * number)
solution = square(10)
number = int(input("What number would you like the square to be? "))
solution = square(number)
print("That number squared is {}".format(solution))
vbqlkxxmbb
5,030 Points@Joseph Cook what did you exactly change in line 4 for code to work??
1 Answer
Steven Parker
231,269 PointsThe workspace has no way to test if the program achieves the requirements.
I'm guessing you're on task 2. The instructions say "call your new function and pass it the argument 3 .", but this code is passing 10 instead.
They also say "create a new variable named result to store the value...", but this code is storing in a variable named "solution" instead.
And you won't need to "input" or "print" anything, so everything after the 3rd line shouldn't be there.
Joseph Cook
195 Pointsthis is what the instructions say: Create a function named square. It should define a single parameter named number. In the body of the function, return the square of the value that was passed in.
Steven Parker
231,269 PointsThat's task 1, your first 2 lines cover that by themselves. I assumed you were working on task 2 with the rest.
Joseph Cook
195 PointsJoseph Cook
195 Pointsoops just looked at the pharasing of line 4, I will change that.