Arithmetic Operators

Arithmetic Operators are used to perform basic mathematical arithmetic operators like addition, subtraction, multiplication, etc. The following table lists out all the arithmetic operators in Python.

Operator SymbolExampleDescription
+x + yReturns addition of x and y.
x – yReturns the subtraction of y from x.
*x * yReturns the multiplication of x and y.
/x / yReturns the result of division of x by y.
%x % yReturns the reminder of division of x by y. Known as modular division.
**x ** yReturns x raised to the power of y. Exponentiation.
//x // yReturns the integer quotient of division of x by y.
Python Arithmetic Operators

Example

In the following program, we will take values in variables x and y, and perform arithmetic operations on these values using Python Arithmetic Operators.

Python Program

x = 5
y = 2

addition = x + y
subtraction = x - y
multiplication = x * y
division = x / y
modulus = x % y
exponentiation = x ** y
floor_division = x // y

print(f'x + y = {addition}')
print(f'x - y = {subtraction}')
print(f'x * y = {multiplication}')
print(f'x / y = {division}')
print(f'x % y = {modulus}')
print(f'x ** y = {exponentiation}')
print(f'x // y = {floor_division}')
Try Online

Output

x + y = 7
x - y = 3
x * y = 10
x / y = 2.5
x % y = 1
x ** y = 25
x // y = 2

Conclusion

In this Python Tutorial, we learned about all the Arithmetic Operators in Python, with examples.