Operator is an symbol that tells the compiler to perform specific mathematical or logical manipulation. Python provides a various of operators, they are,
- Arithmetic operators
- Relational Operators
- Assignment Operators
- Logical operators
- Identity operators
- Bitwise Operators
- Membership Operators
Arithmetic operators
Arithmetical operator is used to perform mathematical operations.
Operator | Description |
+ | + operator is used to add two values. |
– | – operator is used to subtract two values. |
* | * operator is used to multiply two values. |
/ | / operator returns quotient after dividing 1st operand by 2nd operand. |
% | % operator returns remainder after dividing 1st operand by 2nd operand. |
** | ** operator calculates the 1st operand power by the second operand. |
// | // operator returns the quotient(answer or result of division) in which the digits after the decimal point are removed. |
Relational Operators
Relational operator is used to compare two values.
Operator | Description |
== | If both the condition are true then the condition will become true. |
< | This operator will check whether the left operand is less than the right operand. |
> | This operator will check whether the right operand is greater than the left operand. |
<= | This operand will check whether the left operand is less than or equal to the right operand. |
>= | This operand will check whether the right operand is greater than or equal to the left operand. |
!= | If both the operand are not equal then the condition will become true. |
Assignment Operators
Assignment operator is used to assign the values.
Operator | Description |
= | This operator assign the value from the right to left. |
+= | This operand adds the right operand to the left and assign the value to left operand. |
-= | This operand subtract the right operand to the left and assign the value to left operand. |
*= | This operand multiply the right operand to the left and assign the value to left operand. |
/= | This operand divide the right operand to the left and assign the value to left operand. |
%= | This operand takes the modulus from both the operand and assign values to left operand. |
Logical operators
Logical operator is used to perform logical operations.
Operator | Description |
AND | If both the expression are true then the condition will become rue. |
OR | If any one of the expression is true then the condition will become true. |
NOT | If the expression result is false this operand will convert the result into true. |
Identity operators
Identity operator is used to compare memory location of two objects.
Operator | Description |
is | If both side of the variable point to the same object then it will return true. Otherwise false. |
is not | If both side of the variable point to the same object then it will return false. Otherwise True. |
Membership Operators
Membership operator is used to check whether the membership value present in a list, tuple, or dictionary.
Operator | Description |
in | If the specific value present in the object, then it will return true. Otherwise false. |
not in | If the specific value is not present in the object, then it will return true. Otherwise false. |
Bitwise Operators
Bitwise operator is used to compare binary values.
Operator | Description |
$(AND) | Bitwise AND operator returns 1 if both the bits are 1, otherwise 0. |
|(OR) | Bitwise OR operator returns 1 if any of the bit is 1. It both are true it will return 0. |
^(XOR) | Bitwise XOR operator returns 1 if one of the bit is 0 and other bit is 1. |
<<(Left Shift) | The left operands value is moved left by the given number of times in the right operand. |
>>(Right Shift) | The left operands value is moved right by the given number of times in the right operand. |
This is a very carefully managed blog. It makes me want to sign up for the RSS feed 🙂
Thanks for your support bro.
Thought I would comment and say great theme, did you design it on your own? Its really great!
No bro I purchased it.
Generally I do not post on blogs, but I would like to say that this post really forced me to do so! really nice post
Your place is valueble for me. Thanks!?This web page is known as a stroll-by means of for all the information you needed about this and didn’t know who to ask. Glimpse here, and you’ll definitely uncover it.
You have mentioned very interesting details ! ps nice internet site .
Zaraz na poczatku zycia ktos powinien nam powiedziec, ze umieramy. Moze wtedy zylibysmy pelnia zycia, w kazdej minucie kazdego dnia. – Michael Landon
Ꮃonderful ƅlog! I found іt while surfing
around on Yahoo News. Do you have any tipѕ on hоw to gеt listed in Yahoo News?
I’ve been trying for a while but I never seem to gï½…t there!
Thank you
Resources just like the one you mentioned here will be very helpful to me! Ill put up a hyperlink to this page on my blog. Im positive my visitors will discover that very useful. Huge thanks for the helpful info i found on Domain Information Anyway, in my language, there arent much good source like this.