(1) Python supports arithmetic operators that are used to perform the four basic arithmetic operations as well as modular division, floor division, and exponentiation.
Operator
Name
Example
+
Addition
a + b
–
Subtraction
a – b
*
Multiplication
a * b
/
Division
a / b
%
Modulus
a % b
**
Exponents
a ** b
//
Floor Division
a // b
(2) Example of four basic arithmetic operators is given below.
(3) Example of modular division, floor division, and exponentiation is given below.
Modular Division (%)- Divides the operand on the left by the operand on the right and returns the remainder.
Floor Division (//)- Divides the operand on the left by the operand on the right and returns the quotient by removing the decimal part. It is sometimes also called integer division.
Exponentiation (**)- Performs exponential (power) calculation on operands. That is, raise the operand on the left to the power of the operand on the right. For example- 9**2 = 9*9; 9**3 = 9*9*9 etc.
Comments (No)