Returning multiple values from a function in Python
- thecuriouslad
- Oct 3, 2019
- 1 min read
Updated: Oct 4, 2019
The thing is, we are not really returning multiple values here. We're just returning a tuple object of two elements. It is later unpacked when we provide two variables to store them. If we give only one variable, it will be stored as a tuple object.
So whenever we return multiple values from a function, it will be returned as a single tuple which we can unpack later on.
Comentários