Arithmetic Operators

Arithmetic operators are used to perform mathematical calculations in Python. They allow you to add, subtract, multiply, divide, and perform other numeric operations. These operators are commonly used in calculations, financial programs, data analysis, and many real world applications.

Understanding arithmetic operators is essential for building logical and calculation based programs.

ADDITION OPERATOR

The addition operator is represented by the plus sign.

Symbol: +

Example:

x = 10
y = 5
print(x + y)

Output will be 15.

SUBTRACTION OPERATOR

The subtraction operator is represented by the minus sign.

Symbol: –

Example:

x = 10
y = 5
print(x – y)

Output will be 5.

MULTIPLICATION OPERATOR

The multiplication operator is represented by the asterisk symbol.

Symbol: *

Example:

x = 10
y = 5
print(x * y)

Output will be 50.

DIVISION OPERATOR

The division operator divides one number by another.

Symbol: /

Example:

x = 10
y = 5
print(x / y)

Output will be 2.0

Note that division always returns a float value in Python.

FLOOR DIVISION OPERATOR

Floor division removes the decimal part and returns only the whole number.

Symbol: //

Example:

x = 10
y = 3
print(x // y)

Output will be 3.

MODULUS OPERATOR

The modulus operator returns the remainder after division.

Symbol: %

Example:

x = 10
y = 3
print(x % y)

Output will be 1.

EXPONENT OPERATOR

The exponent operator is used to calculate the power of a number.

Symbol: **

Example:

x = 2
y = 3
print(x ** y)

Output will be 8.

IMPORTANCE OF ARITHMETIC OPERATORS

Arithmetic operators are fundamental in programming. They are used in calculations, financial systems, statistical analysis, and logical problem solving.

Mastering arithmetic operators helps you build strong mathematical logic and create efficient Python programs.

Home » PYTHON FUNDAMENTALS (PYF) > Operators > Arithmetic Operators