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 trialMartin Kolejak
279 PointsI don't understand why my code still doesn't work on a website because on a launch workspace it works.
This is my code.
def square(number): return(number * number)
number_for_square = int(input("Write a number for square ")) result = square(number_for_square) print("The square of {} is {}.".format(number_for_square, result))
And this is a mistake.
.
Ran 1 test in 0.001s
OK
E
ERROR: test_results (main.TestFunctionDefinitionExecution)
Traceback (most recent call last): File "", line 48, in test_results File "/workdir/utils/challenge.py", line 20, in execute_source exec(src) File "", line 4, in EOFError: EOF when reading a line
Ran 1 test in 0.001s
FAILED (errors=1)
def square(number):
return(number * number)
number_for_square = int(input("Write a number for square "))
result = square(number_for_square)
print("The square of {} is {}.".format(number_for_square, result))
1 Answer
Steven Parker
231,269 PointsThe instructions only ask you to create the function in task 1. Then, in task 2 you will call the function "and pass it the argument 3".
Your function is OK, but for the challenge you won't need to prompt, input, or print anything. And be sure to pass "3" as the argument when you call the function and assign "result".
Martin Kolejak
279 PointsMartin Kolejak
279 Pointsthank you very much :)