## Data Science Python Certification Training

- 84k Enrolled Learners
- Weekend/Weekday
- Live Class

A boolean value is basically named as TRUE or FALSE. Boolean is one of the basic data types used in every computer programming language. In this computer-world returns, the Boolean value is one of the two possible values which is denoted by **TRUE or FALSE**. The Following Pointers will be covered in this Boolean in Python article:

- What is a Boolean value?
- Relational Operators
- Boolean Operators
- When comparing string capitalization counts
- Logical Operators
- Not Keyword

Boolean is named after George Boole who first defined the Boolean algebraic for logical expressions in the mid of the 19th century. Boolean or Boolean logic is called a subset of the algebra used to tell either True or False. Boolean expressions use with conditional operators such as AND, OR, XOR and NOT to compare values.

Comparison operators and Logical operators which basically returns the Boolean value and used for making logical decisions and comparing the different values. Boolean, when converted into integers values, would be 0 and 1, 0 as False and 1 as True. Many operations and functions returns to Boolean values.

Many programming languages have various data types Boolean is one among them, Python supports Boolean data type but there are certain other languages which do not support Boolean data type. Boolean or Comparative operators needs two operands to evaluate.

Moving on with this article on Boolean in Python

**We compare two operands to give value in Boolean values.**

**Relational Operators.**

Operators | Description | Example |

Greater Than (>) | The condition turns TRUE if value of left operand is greater than right operand value. | a>b |

Less Than (<) | The condition turns TRUE if value of left operand is lesser than right operand value. | a < b |

Equal to (==) | If the value of left and right operand is same the condition turns TRUE. | a == b |

Not equal (!=) | If values of two operands are not equal then the condition turns TRUE. | a != b |

Greater than or equal to (>=) | The condition turns TRUE if the left operand value greater than the right operand value. | a >= b |

Less than or equal to (<=) | The condition turns TRUE if the left operand value less than the right operand value. | a <= b |

Moving on with this article on Boolean in Python

**Here **is** the list of Boolean Operators**

Operators | Description | Example |

Not (!) | Boolean Not | Not (a and b) is false |

AND (&&) | If both the value of the operands are true the condition turns TRUE. | a && b |

OR (||) | The condition turns true if either one of the operands is TRUE. | a || b |

We write Boolean value True not as a string.

True

`True`

False

`False`

Python supports the bool data type. To get to know the data type

type(True)

`bool`

A couple of the comparison operators listed below with the Boolean values.

1 > 2

`False`

2 == 2

`True`

2 > 1

`True`

3 < 6

`True`

4 <= 7

`True`

Moving on with this article on Boolean in Python

‘Bye’ == ‘bye’

`False `

‘2’ == 2

`False `

3 != 3

`False `

Moving on with this article on Boolean in Python

1 < 2 < 3

`True `

1 < 2 >3

`False`

1 < 2 and 2 > 3

`False`

1 < 2 and 2 < 3

`True`

‘h’ == ‘h’ and 2 == 2

`True`

1 < 2 or 2 > 3

`True`

Moving on with this article on Boolean in Python

Not 1 == 1

`False`

400 > 5000

`False`

Not 400 > 5000

`True`

With this, we come to an end of this Boolean in Python article. I hope you got to know the different types of Boolean Operations.

*Got a question for us? Please mention it in the comments section of this “Boolean in Python article” and we will get back to you as soon as possible.*

*To get in-depth knowledge on Python along with its various applications, you can enroll for live Python online training with 24/7 support and lifetime access. *

Comments 0 Comments

REGISTER FOR FREE WEBINAR

Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP