Boolean Data TypeBoolean Data Type

Welcome to section three! In this section, we'll dive into another Python data type: the boolean or logical type. Booleans can only have one of two values: True or False. This data type comes into play when evaluating logical conditions.

Here are the logical operators for comparison:

  • == equal to;
  • != not equal to;
  • > greater than;
  • < less than;
  • >= greater than or equal to;
  • <= less than or equal to;

When you apply these operators, the result will be a boolean value: True if the condition is met, and False if it isn't. For instance, consider the following evaluations:

What do the results above signify? The first True indicates that 1 is equal to 1 (which is self-evident); the second False suggests that the strings "abc" and "aBc" differ due to the case sensitivity of the letter 'b'. The final False implies that 87*731 isn't greater than or equal to 98*712. In fact, 63597 is less than 69776.


Task

Now, let's evaluate the following:

  1. Is 765*43 less than or equal to 456*78?
  2. Is the string "text" not the same as "TEXT"?
  3. Does the string length of "Python" equal 6?
question-icon

Fill in the blanks to complete the task.

# Check the following statements
print(765*43
_ _ _
456*78)
print("text"
_ _ _
"TEXT")
print(len("Python")
_ _ _
6)
True
True
True

Click or drag`n`drop items and fill in the blanks

dots
>=
dots
<=
dots
>
dots
!=
dots
==
down-icon

Everything was clear?

Section 3. Chapter 1