# Python Arithmetic Operators

## Arithmetic Operators in Python.

For performing mathematical operations such as addition , subtraction , multiplication, division, etc., arithmetic operators are used.

In between operands, arithmetic operators can be set. Elements on which operation is supposed to be performed are called operand in mathematical operations, and the operator used between two operands performs the type of operation.

All arithmetic operators in python are discussed below  in detail with their syntax and proper example:

It adds two opreands and returns there sum.

Syntax

Operand1 + Operand2 = Result

Example

>>> a=10
>>> b=20
>>> a+b
30
>>> a+1
11
>>> "PREP"+"INSTA"
'PREPINSTA'
>>> 2+3
5

#### 2. Subtraction(–)

It subtracts one operand from the other and returns there difference either positive or negative depending on the actual values of operands.

Syntax

Operand1 - Operand2 = Result

Example

>>> a=10
>>> b=20
>>> b-a
10
>>> a-1
9
>>> 20-3
17

#### 3. Multiplication(*)

It multiplies two operands and returns the product of both the operands.

Syntax

Operand1 * Operand2 = Result

Example

>>> a=10
>>> b=20
>>> a*b
200
>>> a*9
90
>>> 20*3
60
>>> "Prep"*3
'PrepPrepPrep'

#### 4.Division ( / )

It divides one operad by another and returns the quotient in floating point values.

Syntax

Operand1 / Operand2 = Result

Example

>>> a=10
>>> b=20
>>> b/a
2.0
>>> a/2
5.0
>>> 20/3
6.666666666666667

#### 5.Modulus ( % )

It divides one operand by another and returns the remainder if there is any else it returns 0.

Syntax

Operand1 % Operand2 = Result

Example

>>> a=10
>>> b=25
>>> b%a
5
>>> a%3
1
>>> 20%3
2

#### 6.Exponential ( ** )

The exponential operator (**) is used to calculate power. e.g., 23 (2 raised to power 3).

Syntax

Operand1 ** Operand2 = Result

Example

>>> a=10
>>> b=2
>>> a**b
100
>>> a**3
1000
>>> 2**3
8

#### 7.Floor Division ( // )

The Floor Division operator divides two operands and returns the quotient as a whole number which is the largest possible integer.

Example,

if 10/3 = 3.33333

then, 10//3 will be the the greatest possible integer which is 3 itself.

Syntax

Operand1 // Operand2 = Result

Example

>>> a=10
>>> b=3
>>> a//b
3
>>> a//6
1
>>> 70//8
8