## What are Operators in Python | Explain Arithmetic Operators in Python | Python Tutorial

Operators are special symbols in Python that carry out arithmetic or logical computation. The value that the operator operates on is called the operand. For example, in the expression 4 + 5 = 9, the plus sign (+) is the operator that performs addition. The 4 and 5 are the operands.

There are different types of operators in Python, including arithmetic operators, comparison operators, assignment operators, logical operators, and more.

Arithmetic operators are used to perform mathematical operations like addition, subtraction, multiplication, etc. on numeric values (operands). For example:

## Copy code

a = 4

b = 5

c = a + b

print(c)  # Output: 9

# subtraction

a = 4

b = 5

c = a - b

print(c)  # Output: -1

# multiplication

a = 4

b = 5

c = a * b

print(c)  # Output: 20

# division

a = 10

b = 5

c = a / b

print(c)  # Output: 2.0

# modulus

a = 10

b = 3

c = a % b

print(c)  # Output: 1

# exponent

a = 2

b = 5

c = a ** b

print(c)  # Output: 32

These operators follow the standard mathematical rules for arithmetic operations. For example, the multiplication operator (*) has a higher precedence than the addition operator (+), so the expression 4 + 5 * 6 will be evaluated as 4 + (5 * 6) = 34.

We can use parentheses to change the order of evaluation in a mathematical expression. For example, (4 + 5) * 6 will be evaluated as (9) * 6 = 54.

Overall, operators are an important part of Python, and they can be used to perform a wide range of operations on variables and values in your code.