Booleans

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:
Complete Python Bootcamp: Go from zero to hero in Python

Boolean

To define a boolean in Python we simply type:

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

You can also type:

which is equivalent to FALSE. Likewise you can write

which is the same as TRUE.

Previous Post
Next Post

Leave a Reply