"Anthony Casey" wrote
five and two
2
I understand what it's doing here: returning the operand. But what is the
practical application of that? How might I use that function?
Try
bool(2)
True
bool(0)
False
So you can use the retuirn from the and as a boolean value in a test
condition:
On Wed, Sep 2, 2009 at 6:30 AM, Anthony Casey wrote:
> Hello, tutors.
>
> I'm someone who used to programme as a hobby and who is trying to get back
> into it via Python. I'm reading Programming in Python 3 by Summerfield
> (excellent book).
>
> I read something unusual about Boolean operations in
On Wed, Sep 2, 2009 at 4:30 AM, Anthony Casey wrote:
> Hello, tutors.
>
> I'm someone who used to programme as a hobby and who is trying to get back
> into it via Python. I'm reading Programming in Python 3 by Summerfield
> (excellent book).
>
> I read something unusual about Boolean operations i
Hello, tutors.
I'm someone who used to programme as a hobby and who is trying to get back
into it via Python. I'm reading Programming in Python 3 by Summerfield
(excellent book).
I read something unusual about Boolean operations in Python:
>>> five = 5
>>> two = 2
>>> zero = 0
>>> five and two
2