On Sun, Mar 23, 2008 at 4:41 PM, elis aeris <[EMAIL PROTECTED]> wrote:
> def returning (): > a = 1 > b = 2 > return a, b > > > ab = returning() > > > does this work? > I cut and pasted into an interactive Python session: >>> def returning (): ... a = 1 ... b = 2 ... return a, b ... >>> >>> ab = returning() >>> print ab (1, 2) if it does, is ab a tuple of 2 and [0] being a and [1] being b? > >>> print type(ab) <type 'tuple'> >>> print ab[0] 1 >>> print ab[1] 2 I don't know what environment you're using - I use Windows XP. 1 - Start/Run, 'cmd', OK gets me a command prompt. 2 - I type "python" and hit Enter - I have a Python interactive session. 3 - I highlight your code snippet, hit Ctrl-Ins to copy it, then right-click in the Python session and select Paste. Ten seconds down, and there's your answer. Your question was reasonably well thought-out and phrased - you're halfway there. Go the other half - try it yourself as I did, and if there's still something (like an error message) you don't understand, post the code AND the result when you tried it. It only takes an extra minute, and it gets you a LOT more credit here. Cut, Copy, and Paste are your friends. -- www.fsrtechnologies.com
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor