Python web developement using python(tuples)

can you please elaborate the statement(tuples returns multiple values from a function.)

Hey,
Sometimes it is required to return multiple values from a function, in that case we use tuples.
Tuple basically combine multiple variables into one. For eg.

def examples():
    '''This function returns values from 1-10 and their corresponding squares'''
    a = np.arange(10)
    b = a**2
    return (a,b)

when calling the function we can unpack the tuples like this :
num, num_squares = examples()

Thanks :slight_smile:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.