this can be the dumbest question in the world but i cant figure it out, in 8.Taking a vacation the function answer returns 42 , why isn't 42 printed in the console window ? or where is the value (42) stored ? i tried printing answer() then error appeared " did you accidentally print 42 instead of printing it "
It's perfectly acceptable to write
print answer(). The error just comes up because that's not what codecademy is expecting you to do.
return something in a function, it just takes the value that was returned and passes it to wherever the function was called in your script.
For example, in this code:
def answer(): return 42 print answer()
The last line should
answer() returns. This doesn't work in the exercise because the instructions said just to return
Hope this helped and let me know if you have any questions !
i got it, thanks