Python "and" behavior

Mensanator mensanator at aol.com
Fri Aug 14 02:52:40 CEST 2009


On Aug 13, 7:36 pm, goldtech <goldt... at worldpost.com> wrote:
> Could you explain or link me to an explanation of this? Been using
> Python for a while but not sure I understand what's happening below.
> Thanks.
>
>
>
>
>
> >>> ss=1 and "fffff"
> >>> ss
> 'fffff'
> >>> ss=0 and "fffff"
> >>> ss
> 0


Does this help?

>>> ss = True and 'fffff'
>>> ss
'fffff'
>>> ss = False and 'eeeee'
>>> ss
False





More information about the Python-list mailing list