A value of `bool`

type represents a Boolean
(true or false) value. There are only two values,
written in Python as “`True`

”
and “`False`

”.

Internally, `True`

is represented as 1 and
`False`

as 0, and they can be used in
numeric expressions as those values.

Here's an example. In Python, the expression
“

” compares
two values * a* <

`b`

`a`

and `b`

, and
returns `True`

if `a`

is less than `b`

, `False`

is `a`

is greater than or equal to `b`

.
>>> 2 < 3 True >>> 3 < 2 False >>> True+4 5 >>> False * False 0

These values are considered `False`

wherever
true/false values are expected, such as in an `if`

statement:

The

`bool`

value`False`

.Any numeric zero: the

`int`

value`0`

, the`float`

value`0.0`

, the`long`

value`0L`

, or the`complex`

value`0.0j`

.Any empty sequence: the

`str`

value`''`

, the`unicode`

value`u''`

, the empty`list`

value`[]`

, or the empty`tuple`

value`()`

.Any empty mapping, such as the empty

`dict`

(dictionary) value`{}`

.The special value

`None`

.

All other values are considered `True`

.
To convert any value to a Boolean, see Section 20.5, “`bool()`

: Convert to Boolean”.