On Sun, 22 Dec 2013 15:41:06 -0800 (PST), Bob Rashkin <rrash...@gmail.com> wrote:
On Sunday, December 22, 2013 4:54:46 PM UTC-6, dec...@msn.com wrote:
> How am I supposed to do so I can return also a value to the
variable y WITHOUT printing 'Now x =', w, 'and y = ' , z a second time ?

You are apparently asking 3 questions.
To exchange 2 values, use the tuple-unpack approach.

a, b = b, a

To get the equivalent of multiple return values,  return a tuple.

def myfunc (a):
    x = a*a
    y = 2+a
    return x, y

p , q = myfunc (5)

To avoid executing your print twice, call the function only once.

And a bonus one: to avoid my getting a blank message in this text newsgroup, post in text, not html.

--
DaveA

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to