Operator
1. Arithmetic Operator
ex: +, -, *, /, //, % (modulus), ** (exponentiation)

code:
arithmetic.py
py
# + - * /
print("1 + 1 = ", 1 + 1)
print("2 - 1 = ", 2 - 1)
print("2 * 3 = ", 2 * 3)
print("6 / 2 = ", 6 / 2)
# ** // %
print("2 ** 3 = ", 2 ** 3) # 2 power of 3 = 8
print("5 // 2 = ", 5 // 2)
"""
5 / 2 = 2.5
5 // 2 = 2
// only get the integer part of the division, and discard the decimal part.
"""
print("5 % 2 = ", 5 % 2) # get the remainder of the divisionResults
1 + 1 = 2
2 - 1 = 1
2 * 3 = 6
6 / 2 = 3.0
2 ** 3 = 8
5 // 2 = 2
5 % 2 = 12. Assignment operator (=)
Use when we want to
assign a data to a variable name.code:
assignment-operator.py
py
name = "John"
print(name) # Output: JohnINFO
"=" here is assignment operator
Results
John3. Compound Assignment Operators

Equivalent operators format
| Operators | Equivalnet to - |
|---|---|
| a += b | a = a + b |
Code:
compound-assignment-operator.py
py
# define a, b, c
a = 10
b = 5
c = 2
# Usage
# 1. a + b = 15
a = a + b
print(a) # Output: 15
a += c # equivalent to a = a + c
print(a) # Output: 17Results:
15
17