What is a boolean?

A boolean is a variable that is either True or False. We say the datatype of a variable can be booelan.

You can think of it like a light switch, its either on or off.

Note: A bit is the smallest unit in a computer. Its either 0 or 1, True or False. Also called a boolean

Related Course:


To define a boolean in Python we simply type:

light = FALSE

If you want to set it to on, you would type:

light = TRUE

You can also type:

light = 0

which is equivalent to FALSE. Likewise you can write
light = 1

which is the same as TRUE.