Sumitava Mukherjee <[EMAIL PROTECTED]> wrote:
>Hi all,
>I am a novice programmer in Python.
>Please could you explain me the results (regarding logical operators).
>
>I get this:
>
print bool('God' and 'Devil')
>True
>
>[This is ok because (any) string is True, so; (True and True) gives
>True
On Mon, 20 Oct 2008 18:41:23 -0700, Sumitava Mukherjee wrote:
> What is python doing when we type in ('God' and 'Devil') or key in (01
> and 10) ?
There are two important things you need to know:
(1) All Python objects have a boolean context.
(2) Python's boolean operators are short-circuit op
On Oct 20, 9:41 pm, Sumitava Mukherjee <[EMAIL PROTECTED]> wrote:
> Hi all,
> I am a novice programmer in Python.
> Please could you explain me the results (regarding logical operators).
>
> I get this:
>
> >>> print bool('God' and 'Devil')
>
> True
>
> [This is ok because (any) string is True,
Not
On Oct 20, 8:41 pm, Sumitava Mukherjee <[EMAIL PROTECTED]> wrote:
> Hi all,
> I am a novice programmer in Python.
> Please could you explain me the results (regarding logical operators).
>
> I get this:
>
> >>> print bool('God' and 'Devil')
>
> True
>
> [This is ok because (any) string is True, so;
Hi all,
I am a novice programmer in Python.
Please could you explain me the results (regarding logical operators).
I get this:
>>> print bool('God' and 'Devil')
True
[This is ok because (any) string is True, so; (True and True) gives
True]
>>> print('God' and 'Devil')
Devil
[This is what I d