How to run a def with multiple values only once and use values into another def?
<p>My problem is real simple but unfortunately i can't find a way to solve it.</p>

<p>I would like to run a def A which returns multiple values from def B only once.</p>

<p>I wrote this block of code :</p>

<pre><code>def A():
    x = 1
    y = 2
    z = 3
    return a,b,c

def B():
    d = A[0] + A[1]
    e = A[2] - A[0]
    print d,e

B()
</code></pre>

<p>If i'm using this block of code it will run four times!</p>

<p>Thanks in advance.</p>

<p>I would do this: </p>

<pre><code>def B():
    a, b, c = A()
    d = a + b
    e = c - a
    print d,e
</code></pre>

<p>But make sure your function <code>A()</code> is returning the same variables it is declaring (<code>x, y, z</code> not <code>a, b, c</code>).</p>

python return