From your question, what I think you want the zap will have the value "Put on some pants!" , and thing will mean "And don't forget your underwear!" . If this is your problem, discuss it. Otherwise, you do not need to read further, as I just discussed about all this.
Let it be fun. When you define a function, you are like creating a machine that does what you want. Now think about the car, that when you give her some food, she cuts them off and ... does nothing! I mean, I made this machine to cut food and nothing more! You will not get your chopped food, but in fact it chopped your food, as you did.
Now that you want your chopped food back, you create another machine that takes your food, beats it and returns them to you. A fruitful machine, right ?; -)
They are all true for programming or math functions (although I don't know any void function in math !: P). When you create a function, you must tell it whether it simply does some work or does some work and returns a result. A way to specify a function is with the return . In your functions, you just said do something. And this print "......" , as well as functions. You call the with () command at the end and do your job, they print it. But, as I said, if you do not tell him to return the result, this will not happen. And since it does not return any result, nothing will be assigned to the variable (do not confuse it with None ). When you write these lines (if in the interpreter) or run the script, you will see that these lines are printed, but your zap and thing have no meaning.
So how to fix this? Tell them to return rows to variables. To report this, replace the print statements with return . And it doesn’t matter to experiment that you know, to know about what you know about your knowledge, right :-)
Hope this helps :-)
emnoor
source share