Samuel Varghese Samuel Varghese - 1 month ago 6
Python Question

How to take multiple values outputted by a function

Quick question. For example, let's say that a function outputs two variables in python. So outputA and outputB. How do take outputA and do something with it like add outside of the function.

Answer

You return a tuple (pair), so use something as

    first, second = example(10)

and then use first to do something with it.