
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
What are boolean operators in Python?
The logical operators and, or and not are also referred to as boolean operators. While and as well as or operator needs two operands, which may evaluate to true or false, not operator needs one operand evaluating to true or false.
Boolean and operator returns true if both operands return true.
>>> a=50 >>> b=25 >>> a>40 and b>40 False >>> a>100 and b<50 False >>> a==0 and b==0 False >>> a>0 and b>0 True
Boolean or operator returns true if any one operand is true
>>> a=50 >>> b=25 >>> a>40 or b>40 True >>> a>100 or b<50 True >>> a==0 or b==0 False >>> a>0 or b>0 True
The not operator returns true if its operand is a false expression and returns false if it is true.
>>> a=10 >>> a>10 False >>> not(a>10) True
- Related Articles
- Java Boolean operators
- What are different basic operators in Python?
- What are different arithmetic operators in Python?
- What are different Identity operators types in Python?
- What are different assignment operators types in Python?
- What are different bitwise operators types in Python?
- What are Boolean Expressions?
- What are operators in JavaScript?
- What are Boolean literals in Java?
- What are Boolean Literals in C++?
- What are JavaScript Operators
- What are Arithmetic Operators in JavaScript?
- What are Comparison Operators in JavaScript?
- What are Logical Operators in JavaScript?
- What are Assignment Operators in JavaScript?

Advertisements