Samuel Varghese Samuel Varghese - 1 year ago 63
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 Source

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

    first, second = example(10)

and then use first to do something with it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download