Earn 20 XP


  • Operators perform simple operations such as additions, comparisons, etc., on variables and values.

  • Python supports the following types of operators; we will look at some commonly used operators in this tutorial.

image.png

Arithmetic Operators

Using Python, we can perform some basic arithmetic operations such as addition, subtraction, multiplication, etc.

Example:

1 x = 2

1 y = 3

1 x + y
(addition)
1 x * y
(multiplication)

Snapshot of basic arithmetic operations on notebook

Arithmetic 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