value of 2. Then:
Operators
Definition
Examples
//
or Floor Division
It divides the operands where the resulting value is the quotient in which
the numbers past the decimal point are deleted.
10 // 2 equals 5 and 10.0 // 2.0 =
5.0
* or Exponents
It performs a power (exponential) computation on the operators.
X ** Y = 2 to the power of 1
%
or Modulus
It divides the left operand by the value of the right operand and gives out
the remainder.
Y % X = 0
+
or Addition
This operator simply adds the values of the operands.
X + Y = 3
- Or Subtraction
This operator subtracts the value of the right operand from the left operand.
X – Y = 1
* or Multiplication
This operator multiples the values of the operands.
X * Y = 2
/ or Division
It the divides the value of the left operand by the left operand.
Y / X = 2
Logical Operators
These are the logical operators used in the Python programming language.
We will assume
that variable X is equal to 1 and variable Y is equal to 2.
Operators
Definition
Examples
Logical AND (and)
The condition is only true if the two operands are true.
(X and Y) is true.
Logical OR (or)
The condition is only true if one of the operands is not equal to zero.
(X and Y) is true.
Logical NOT (not)
This operator is used to reverse an operand’s logical status.
Not (X and Y) is false.