An operator is used to perform specific mathematical or logical operations on values . The values that the operators work on are called operands .

Example:

Expression:  25 + num 

  • operator is ‘+’
  • Operands are 25 and num

Python supports several types of operators. 

Arithmetic Operators

Python supports arithmetic operators that are used to perform the four basic arithmetic operations as well as modular division, floor division and exponentiation.

Arithmetic Operators - Teachoo.jpg

Relational Operators

Relational operator compares the values of the operands on its either side and determines the relationship among them.

Relational Operators - Teachoo.jpg

Assignment Operators

Assignment operator assigns or changes the value of the variable on its left.

 

 

Logical Operators

The logical operator evaluates to either True or False based on the logical operands on either side. Every value is logically either True or False.

Logical Operators - Teachoo.jpg

Identity Operators

Identity operators are used to determine whether the value of a variable is of a certain type or not. Identity operators can also be used to determine whether two variables are referring to the same object or not.

 

Membership Operators

 Membership operators are used to check if a value is a member of the given sequence or not.

Membership Operators - Teachoo.jpg

Go Ad-free
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science and Computer Science at Teachoo