KnowledgeBoat Logo
|

Computer Science

Assertion (A): The return statement in Python allows a function to return more than one value at a time.

Reasoning (R): Python functions can return multiple values as a tuple, which is unpacked only if necessary.

Python Functions

1 Like

Answer

Both A and R are true, and R is the correct explanation of A.

Explanation — In Python, a function can return more than one value at a time by returning multiple values separated by commas. These values are packed into a tuple. If needed, the tuple can be unpacked into separate variables.

Answered By

2 Likes


Related Questions