Loading section...

Return Values

Functions do more than just execute code. They can compute results and send them back to wherever they were called. Returning Data Multiple Return Values Python functions can return multiple values as a tuple, which you can unpack into separate variables when calling the function. Functions can also return multiple values as a tuple, which you can unpack into separate variables. A return statement immediately exits the function, so any code written after return in the same block is unreachable and will never execute. Returning None explicitly and implicitly are equivalent. Both signal that the function completed without producing a meaningful value for the caller. Functions that return multiple values as a tuple are a common Python pattern for situations where two related results, such as