top of page

Returning multiple values from a function in Python

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.



Recent Posts

See All
Numpy in a nutshell

Numpy arrays are closer to hardware. Thus, their execution/operation times are significantly lesser compared to the usual pythonic lists....

 
 
 

Comentários


©2019 by thecuriousfolk.com

bottom of page