On 2013-09-10 13:34, novo shot wrote: > When I declare a variable to be equal as the fucntion > (result=theFunction("this either")) is Python also executing the function?
You're not declaring it as equal, that would be `==' (or `is' for identity). `=' assigns, it doesn't check for equality. > The way I see it, I only called for the function once before printing > ARRRGH!! Then after that I declared a variable and then I print. > > This is how I expected the result to look like: > > I don't get this > reply is: I don't get this either > ARRRGH! Why do you expect "reply is" to happen on the second line? It clearly only happens when printing the returned value, not when printing from inside the function itself: > def theFunction(message): > print "I don't get ", message > return "ARRRGH!" > > theFunction("this") > > result=theFunction("this either") > print "reply is: ", result The extra spaces are because "," implies one. If you don't want a double space before the message, remove the trailing space in the string.
pgpLcomPv7jtT.pgp
Description: PGP signature
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor