[Tutor] Help Return's are confusing me

python python <python@inkedmn.net>
Wed, 9 Oct 2002 14:59:43 -0700


peter,

ok, it works like this...

in the example you posted, there are two return statements.  it might
have been better written like this:

def julian_leap(y):
     if (y%4) == 0:
        return 1  #is returned if the conditional is true
     else:
        return 0  #is returned if the conditional is false


it'd look something like this:

>>> def julian_leap(y):
...     if (y % 4) == 0:
...             return "yes"
...     else:
...             return "no"
...
>>> julian_leap(4)
'yes'
>>> julian_leap(7)
'no'


make sense?

brett