The return
statement is only capable of returning one object, sorry for the disappointment. But the object returned can literally be of any valid type, this means that we can also return collections of items such as lists, tuples etc.
We can simulate the return statement to look like it is returning multiple values by returning the values as a tuple.
Brackets in tuples are optional
Remember that the parentheses around tuple elements are optional, this makes the return statement look like it is actually returning multiple values. You should, however, remember to unpack the returned values into variables when calling the function.
The above snippet is from the previous example but without including brackets in the return values. Let us see one last example.
You can also use a list or any other capable object instead of a tuple to return multiple values. However, tuples are generally more efficient and lightweight, making them more suited in this case. The fact that we can also use tuples without the enclosing brackets also makes them look more suited in returning multiple values.