How can I retrieve all the returned variables from a function?
- by user1447941
import random
def some_function():
example = random.randint(0, 1)
if example == 1:
other_example = 2
else:
return False
return example, other_example
With this example, there is a chance that either one or two variables will be returned. Usually, for one variable I'd use var = some_function() while for two, var, var2 = some_function(). How can I tell how many variables are being returned by the function?