"elis aeris" <[EMAIL PROTECTED]> wrote
> def returning ():
>a = 1
>b = 2
>return a, b
>
>
> ab = returning()
>
>
> does this work?
>
> if it does, is ab a tuple of 2 and [0] being a and [1] being b?
Try it in the >>> prompt, thats what its there for and will give you
an instant answ
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
... retur
def returning ():
a = 1
b = 2
return a, b
ab = returning()
does this work?
if it does, is ab a tuple of 2 and [0] being a and [1] being b?
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
so just str(int)
got it,
thanks !
On Fri, Mar 21, 2008 at 5:11 PM, elis aeris <[EMAIL PROTECTED]> wrote:
>
> oh this is brillant, i LOVE python
>
> thank for replying
>
>
> On Fri, Mar 21, 2008 at 5:11 PM, Gregor Lingl <[EMAIL PROTECTED]> wrote:
>
> > elis aeris schrieb:
> >
> > is it possible
oh this is brillant, i LOVE python
thank for replying
On Fri, Mar 21, 2008 at 5:11 PM, Gregor Lingl <[EMAIL PROTECTED]> wrote:
> elis aeris schrieb:
>
> is it possible to return two values?
>
> Yes:
> >>> def return2():
> return "this", "that"
>
> >>> return2()
> ('this', 'that')
> >>> a,b
elis aeris wrote:
> is it possible to return two values?
Yes and no. You can return "a" value, but that value may itself be a
tuple of values. Or a list, dictionary or other kind of object.
> how do I create an empy int array of 10?
If an int array has 10 things in it, it's not empty. You do
elis aeris schrieb:
is it possible to return two values?
Yes:
>>> def return2():
return "this", "that"
>>> return2()
('this', 'that')
>>> a,b=return2()
>>> a
'this'
>>> b
'that'
>>>
Regards,
Gregor
_
is it possible to return two values?
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor