How does the return of Python understand? The first thing to understand is, what is a function?
The book may say that the function is the module of completion function and so on. In fact, the function is a worker you recruit.
You give him some material, tell him how to use these materials to assemble, then he is responsible for the assembled finished products to you. The material is the function parameter, the finished product is the function output, and how to assemble is the function body code which you write.
For example, this piece of code
def worker (A, B, c): = A + b = x * C
The worker, under your guidance, uses a B-c three material to assemble the X and y two finished items.
But the assembly in the program is different from the factory, and the used material does not disappear. In this way, the worker has a b c x y five-like item in his hand. How does he know which one you want?
So the function of return is to tell the worker at this time what you want, whether it's an iphone shell or the entire iphone. For example
def worker (A, B, c): = A + b = x * c return y
So the workers will give y to you. When you let the worker help you work (call the function)
result = Worker (1, 2, 3)
You will get the corresponding result (1+2).
This is the function of return.
Python learning question ———— How does the return of Python understand?