Earn 20 XP


  • Operators are used to perform simple operations such as additions, comparisons etc on variables and values.
  • Python supports the following types of operators, we will be looking at some of the commonly used operators.

image.png

Arithmetic Operators

We can perform some basic arithmetic operations such as addition, subtraction, multiplication, etc. using Python.

Example:

x = 2
y = 3
x + y # addition
x * y # multiplication

Snapshot of basic arithmetic operations on notebook

Aritmetic Operators: Meanings & Examples

image.png

Comparison Operator

  • These are used to compare two values
  • Gives a Boolean result (True/False)

image.png

Comparison Operators: Meanings & Examples

image.png

Logical Operator

  • Logical operators are used to combine conditional statements
  • Gives a Boolean result (True/False)

image.png

image.png