Languages
[Edit]
EN

Python - boolean values

0 points
Created by:
Hiba-Tate
548

In this article, we would like to show you boolean values in Python.

Boolean type has only two possible values:

  1. True
  2. False

Practical examples

Edit

Example 1

Edit

When you evaluate any expression in Python, you get the boolean value as a result - True or False.

In this example, we compare two values to receive a boolean result.

You can check the variable type using type() method:

Example 2

Edit

In this example, we use if statement to create a condition that returns the boolean value True or False. Based on the result, the program will print the appropriate sentence.

Output:

Alternative titles

  1. Python - booleans
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Python - fundamentals

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join