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.
Relational Operators
Relational operator compares the values of the operands on its either side and determines the relationship among them.
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.
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.
Learn in your speed, with individual attention - Teachoo Maths 1-on-1 Class