regularpython@gmail.com
In this chapter, we are going to learn different types of python operators. There are 7 types of operators are available in python. Those are
Python Arithmetic Operator
Python Relational Operator
Python Assignment Operator
Python Logical Operator
Python Membership Operator
Python Identity Operator
Python Bitwise Operator
Python operators play a crucial role in data manipulations.
Python Arithmetic Operators:
This operator is used to add the values.
Arithmetic operators are used to doing basic math operations.
Addtion ( + )
Subtraction ( - )
Multiplication ( * )
Division ( / )
Modulus ( % )
Floor Division ( // )
Exponetiation ( ** )
Python Relational Operators:
Relational operators are used to doing the relation between two operands.
Mostly these operators are used to filter the data. For example, we have movie related data with different languages. We need to get only English language movies. Then we have to use == operator to compare the language.
Equal ( == )
Not Equal ( != )
Greater Than ( > )
Greater Than or Equal ( >= )
Less Than ( < )
Less Than or Equal ( <= )
Python Assignment Operator:
Assignment Operators are used to assigning a value to a variable.
Assign (=)
Add and Assign (+=)
Subtract and Assign (-=)
Divide and Assign (/=)
Multiply and Assign (*=)
Modulus and Assign (%=)
Exponent and Assign (**=)
Floor-Divide and Assign (//=)
Python Logical Operator:
The logical operators are used to combine more than one condition. Python provides three types of logical operators,
and
or
not
Membership Python Operators:
Membership operators are used to searching a substring inside a string. Python provides two types of membership operators,
in
not in
Python Identity Operator:
Python identity operators are used to find the location of the operands. Python provides two types of identity operators,
is
is not
Python Bitwise Operators:
Bitwise Operators are used to doing data manipulations on bits
Binary AND (&)
Binary OR (|)
Binary XOR (^)
Binary One's Complement (~)
Binary Left-Shift (<<)
Binary Right-Shift (>>)