##### Categories Arithmetic operators

Arithmetic operators are used to perform mathematical operations like subtraction,  multiplication, division etc.

 Operator Meaning Example + Add two operands x + y - Subtract  two numbers, subtract right operand from the left x - y * Multiply two operands x * y / Divide two operand Divide left operand by the right one (The results is  a float value ) x / y % Modulus returns the  remainder. Remainder of the division of left operand to the right x % y (remainder of x/y) // Floor division –returns the quotient value or integer value of result for example  5//2  return 2 not 2.5 x // y ** Exponent - left operand raised to the power of right x**y (x to the power y)

Examples:  Arithmetic operators in Python

x = 1

y = 1

​​​​​​​print('x + y =',x + y)

# Output: x + y = 2

print('x - y =',x - y)

# Output: x - y = 0

print('x * y =',x * y)

# Output: x * y = 1

x = 12

y = 5

print('x / y =',x / y)

# Output: x / y = 2.4

print('x % y =',x % y)

# Output: x % y = 2

print('x // y =',x//y)

# Output: x // y = 2

x = 2

y = 3

print('x ** y =',x ** y)

# Output: x ** y = 8

Output

x + y = 2

x - y = 0

x * y = 1

x / y = 2.4

x % y = 2

x // y = 2

x ** y = 8

What is the difference between division(/) and floor division //  operators?

The division operator ( /) performs a division and returns a float value, whereas Floor division operator (//) returns a whole number for example

13 / 5  = 2.6

13 // 5 = 2

13.0 // 5.0 = 2.0

What is the difference between the division  / and the modulus % operator?

The division operator (/) performs  a division and returns a float value, whereas  operator (% ) returns the remainder value for example

12 / 5 = 2.4

12 % 5 = 2

The remainder is an integer left over after dividing one integer by another integer that produces an integer quotient. It is also called an integer division. 