
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Python Boolean Operations
The basic Boolean operations are and, or, not operations.
The and operation − The basic syntax of and operation is: x and y. It indicates that when the x is false, then return x, otherwise returns y.
The or operation −The basic syntax of or operation is: x or y. It indicates that when the x is false, then return y, otherwise returns x.
The not operation − The basic syntax of and operation is: not x. It indicates that when the x is false, then it returns true, otherwise it returns false.
Example Code
x = 25 y = 18 or_op = x or y print(or_op) and_op = x and y print(and_op) not_op = not x print(not_op) x = 0 not_op = not x print(not_op)
Output
25 18 False True
Advertisements