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.
Asked
Active
Viewed 49 times
1
-
1Your question is not at all clear. Please show an example of what you want to do with `outputA`. – Rory Daulton Nov 06 '16 at 18:49
-
1Possible duplicate of [How can I return two values from a function in Python?](http://stackoverflow.com/questions/9752958/how-can-i-return-two-values-from-a-function-in-python) – Sweeney Todd Nov 06 '16 at 18:51
-
so lets say both are array so then how take one output and for example divide it, while the other output i dont do anything. All of this outside the example function above – Sam Nov 06 '16 at 18:57
-
Possible duplicate of [How do you return multiple values in Python?](http://stackoverflow.com/questions/354883/how-do-you-return-multiple-values-in-python) – hookenz Nov 06 '16 at 23:28
1 Answers
1
You return a tuple (pair), so use something as
first, second = example(10)
and then use first
to do something with it.

MarianD
- 13,096
- 12
- 42
- 54
-
-
It makes no difference - `outputA` and `outputB` may be of arbitrary type, even one type for `outputA` and another for `outputB`. – MarianD Nov 06 '16 at 19:03