Boolean Expressions, Comparison Operators and Examples with sample code in Python

Python for BEGINNERS and DUMMIES

Reusable Define Function with Return


Python 2D Lists and Nested Loops Examples


Python exception handling using
try except with examples


Python For Loop condition with examples


Python while condition with examples


Python if elif else logical condition


Python Tuples vs List


Python Translator with Examples


Python List Functions with Examples


Data Structures and Data Types


Python Exponent Function with examples


Python dictionary with examples


Variables, Expressions & Statements


List of 'Reserved Words' in Python


Boolean Expressions &
Comparison Operators

Boolean Expression in Python

Boolean Expression helps in confirming True OR False given a comparison.

Example
> 4 == 4
True
> 6 == 2
False

True AND False are not strings. They belong to type bool.
We can validate the type by using the following example code. > type(True)
type 'bool'
> type(False)
type 'bool'

Comparison Operators in Python

Comparison Operators are available for the purpose of comparison. We validate equal to, greater than or less than and so on. To support these kind of comparisons, we use comparison operators. For example, the earlier used '==' is one os the comparison operator.

The following are list of comparison operators:

a == b # it represents a equal to b

a > b # it represents a greater than b

a < b # it represents a less than b

a != b # it represents a not equal to b

a >= b # it represents a greater than or equal to b

a <= b # it represents a less than or equal to b

a is b # it represents a is the same as b

a is not b # it represents a is not the same as b


Python Interview Questions and
Answers


What are the differences between
Python 2.x vs Python 3.x
(2.7 vs 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9),
when to you which version ?


What is Python Variable, Expression
and Statement ?


What is a 'Reserved Word' in Python ?
List of Reserved words in Python ?

How to Install Python, IDE, UI
to Practice


Download and Install Python from
Python.org


Download and Install Anaconda to Use
SPIDER and Jupyter Notebook