D
PRO
3 months ago
Deborahcountry asked

What is a Boolean expression?

Palistha Singh
Expert
last month

Hi Deborah,

A Boolean expression is a statement that evaluates to either True or False.

For example:

x = 10

if x > 5:
    print("x is greater than 5")

Here, x > 5 is the Boolean expression. Since it’s true, the code inside the if block runs.

Boolean expressions are used in conditions to control the flow of a program — like in if, while, or logical checks.

If you have more questions, I am here to help.

Python
This question was asked as part of the Learn Python Basics course.