Skip to content

Introduction to operators

What are operators?

Operators are symbols that perform operations on operands(values) or variables, which behave generally like functions. Combination of operators and operands form an expression.

Operators in Python

There are seven set of operators in Python, grouped by the type of operations they perform such as mathematical operations, comparison operations, and logical operations on operands which can be values, variables or constants.

  1. Arithmetic Operators:
    Arithmetic operators are used to perform mathematical operations, e.g., +, -, / and so on.

  2. Assignment Operators: These set of operators are used to assign values to variables, e.g., =, +=.

  3. Comparison Operators: Also know as relational operators, and these set includes equality operator ==, inequality operator != and so on.

  4. Logical Operators: Also know as Boolean operators, includes logical and operator, or operator and not operator

  5. Membership Operators: These set consists of operators such as in and not in

  6. Identity Operators: Identity operators in Python includes is identity operator and is not identity operator.

  7. Bitwise Operators: Bitwise operators performs operations on binary numbers, it includes bitwise and operator, bitwise | operator and so on.

These is a quick overview of available operators in Python, hopefully in the next guides we’ll be able to cover each set of operators in depth.