An operator is used to perform specific mathematical or logical operations on values . The values that the operators work on are called operands .
Expression: 25 + num
- operator is ‘+’
- Operands are 25 and num
Python supports several types of 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 operator compares the values of the operands on its either side and determines the relationship among them.
Assignment operator assigns or changes the value of the variable on its left.
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 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 are used to check if a value is a member of the given sequence or not.