Using an example show how a function in Python can return multiple values.
In Python, a function can return multiple values by grouping them into a tuple. When the return statement specifies multiple values separated by commas, Python automatically packs them into a single tuple object which is sent back to the caller.
For example, a function can be defined to calculate both the area and perimeter of a rectangle. The function accepts length and breadth as parameters, computes the values, and returns them simultaneously.
def calc_rect(length, breadth): area = length * breadth perimeter = 2 * (length + breadth) return area, perimeter
In this example, the statement return area, perimeter returns a tuple containing both calculated values to the calling function.
Explanation
The answer is derived from the textbook context which explicitly states that 'Multiple values in Python are returned through a Tuple.' The example provided mirrors Program 7-12 mentioned in the text, which illustrates a user-defined function accepting length and breadth to return area and perimeter. The explanation adheres to the concept that the return statement facilitates sending these values back.