1.Before we Begin


Here's my code:

def answer():
return ("42")

I believe that it should work,although I am getting an error as "Oops, try again.
Your function should return the number 42."


Hi your return should be like that

return 42


Thanks for the reply although the fix was a "tab" away :stuck_out_tongue:


You should do return 42 instead


Hello wizmarco,
I have a question, in this particular case, does these codes:

def answer():
return 42

has the same meaning with these codes:

answer = 42

Sometimes I am a little bit confused between these 2 things:
1) "defining a function, then return it to a certain value"
2) "assigning a certain value" to a variable

I understand that in similar exercises like this one, these 2 things perform the same thing and produce same results. Please correct if I am wrong, just want to know deeper. Thanks :smiley:


No it isn't, @nguyengiang2004. When a function returns a value, it usually performs some action on arguments that are passed to it by the user. A variable has to be manually set by the user and doesn't need arguments in order to work... Hope this clears it out


HI they are different one is a function the other a variable while a function return value in a variable you store value

the same thing and produce same results

yes they will produce the samething

#the function

def answer():
    return 42

#call the function


#the variable

answer = 42
print answer


But they still different.


Ah...now I understand. So the variable just stores value, or like @bartholomewallen said, that it

and just stops at that, while with function, the users can add on further commands for it.


Perfect, @nguyengiang2004!


yah, I think I can stop digging at this point, when I learn more, there'll be more fun.
Thank you guys @wizmarco and @bartholomewallen :balloon: