Logical Operators: Unit - II
Logical Operators: Unit - II
Unit - II
What Are Logical Operators?
Operators are the simplest way to act on data, typically on
simple data types like integers, strings, and floats.
Mathematical Operators
Operators that perform mathematical functions, like adding
numbers together or assigning values to variables.
Logical Operators
Operators that perform logical operations, such as
comparing relative values, checking equality, checking set
membership, or evaluating combinations of other logical
operators.
Relational Operators
Operators that check the relationships between multiple
variables, such as checking if they are equal or if one is
greater than another.
Numeric Comparisons
Non-Numeric Equality Comparisons
Set Operators
Relational Operators in Python
Numeric Equality Comparisons
Relational Operators in Python
Numeric Value Comparisons
Relational Operators in Python
Non-Numeric Equality Comparisons
Relational Operators in Python
Set Operators
Relational Operators in Python
Operators in Action
Boolean Operators
Operators like “and” and “or” that act on pairs of boolean
(true or false) values, or that act on single boolean values,
like “not”.
And
An operator that acts on two boolean (true or false) values
and evaluates to “true” if and only if both are true.
Or
An operator that acts on two boolean (true or false) values
and evaluates to “true” if and only if at least one is true.
Boolean Operators
Not
An operator that acts on one boolean (true or false) value
and evaluates to the opposite value (false becomes true, true
becomes false).