Page 70 - TP_Prime_V2.2_Class7
P. 70
Here, the value of A and B are negative 20 and negative 40, respectively. Unary operators
include + and -, where - negates the value, and + indicates a positive value.
Binary Operators
Binary operators require two operands to operate. For example, in the expression a + b,
the + operator adds the two operands a and b. Python provides the following binary
arithmetic operators:
Prime (Ver. 2.2)-VII Operator Name Description (x=7 and Output MORE ON PYTHON
Example
y=3)
Adds values on either side of the
+
Subtracts right-hand operand from
Subtraction
– Addition operator. x + y 10
4
x – y
left-hand operand.
68 * Multiplication Multiplies values on either side of the x * y 21 69
operator.
/ Division Divides left-hand operand by x / y 2.3335
right-hand operand.
% Modulus Divides left-hand operand by x % y 1
right-hand operand and returns
remainder.
** Exponentiation Performs exponential (power) x ** y 343
calculation on operands.
// Floor division Divides and cuts the fractional part x // y 2
from the result.
Let us see the example below:
Using Arithmetic operators

