Python Operators

Python Operators

Python Arithmetic Operators

Python Program

a = 5
b = 2

print('Addition :', (a + b))
print('Subtraction :', (a - b))
print('Multiplication :', (a * b))
print('Division :', (a / b))
print('Modular Division :', (a % b))
print('Floor Division :', (a // b))
print('Exponentiation :', (a ** b))
Run

Output

Addition : 7
Subtraction : 3
Multiplication : 10
Division : 2.5
Modular Division : 1
Floor Division : 2
Exponentiation : 25

Python Comparison Operators

  • Equal
  • Not equal
  • Greater than
  • Less than
  • Greater than or equal to
  • Less than or equal to

Python Logical Operators

Python Identity Operators

Python Membership Operators

  • in
  • not in

Python Bitwise Operators

  • AND
  • OR
  • XOR
  • NOT
  • Left Shift
  • Right Shift