Menu
Coddy logo textTech

Boolean

Part of the Fundamentals section of Coddy's Python journey — lesson 6 of 77.

A bool (Boolean) type has only 2 possible values: True or False.

Note that these values are case-sensitive, meaning they must start with a capital letter.

Here is an example of assigning a bool value to a variable:

variable_true = True
variable_false = False

In the above, two variables named variable_true and variable_false are initialized, with the values True and False respectively.

Booleans are the building blocks for creating logic in the programs we write. We have a whole chapter about logic and conditions.

challenge icon

Challenge

Beginner

Declare a variable named boolean and assign it the value True.

Cheat sheet

A bool (Boolean) type has only 2 possible values: True or False.

These values are case-sensitive, meaning they must start with a capital letter.

Assigning bool values to variables:

variable_true = True
variable_false = False

Booleans are fundamental for creating logic in programs.

Try it yourself

# Type your code below
boolean = ?

# Don't change the line below
print(f'boolean = {boolean}')
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals