Question: Suppose we want a Python function to return 2 calculated values called result 1 and result 2 . How can we accomplish this? We cannot

Suppose we want a Python function to return 2 calculated values called result1 and result2. How can we accomplish this?
We cannot accomplish this. A function can only return value.
Create a list - say answers -containing result1 and result2. Then return the list answers.
Create a tuple - say results - containing result1 and result2. Then return the tuple results.
Put the statement "return result1, result2" at the end of the function
B or C

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!