Operators in Python



Python supports many operators for it’s operation with data and entity which could be mathematical, logical, or relational equality, non equality and some special operators to perform in an expression.


Additive Operators
X+Y– addition. –Adding entity
X–Y - subtraction-Subtracting entity

Multiplicative Operators
X*Y– Multiplication.-Multiplying first vector element corresponding to the second vector element

Division Operators
X/Y  Division. Dividing first vector element corresponding to the second vector element

Remainder Operators
X%Y--The remainder evaluates first vector with  to the corresponding element of the second vector

Left Shift
X<<Y-- Shift element to the left

Right Shift
X>>Y-- Shift element to the Right


Exponential Operators
X **2-- The first entity x as mantissa had the exponent of 2

Relational Operators
X<Y –Evaluates each element of the first element  is greater than the corresponding element of the second element and result would be Boolean values

X>Y –Evaluates each element of the first is lesser than the corresponding element of the second and result would be Boolean values

X<=Y –Evaluates each element of the first is greater than or equal to the corresponding element of the second and result would be Boolean values

X>Y –Evaluates each element of the first is less than or equal to the corresponding element of the second and result would be Boolean values

Equality Operators
X==Y- Equality. Evaluations happens to ascertain both the values are equal
X!=Y or X<>Y- not equal. Evaluations happens to ascertain both the values are equal

Bitwise AND Operator
X&Y- TRUE if both the elements are TRUE

Element OR Operator
X|Y- TRUE if one the elements is TRUE

Element NOT Operator
!X- “TRUE to False” or “False to True” 

Conditional AND Operator
X and Y-  logical AND. If the first operand is false, it not evaluate the second operand.

Conditional OR Operator
X or Y – logical OR. If the first operand is true, it does not evaluate the second operand.

Assignment  Operator
 =
Miscelaneours Operators
These operators have different aspects to take care in our daily programming work.
`expr,...`     String conversion
{key:expr,...}       Dictionary creation
[expr,...]      List creation
(expr,...)      Tuple creation or simple parentheses
f(expr,...)     Function call
x[index:index]      Slicing
x[index]      Indexing
x.attr Attribute reference
x is y, x is not y     Identity tests
x in y, x not in y    Membership tests
not x  Boolean NOT
lambda arg,...: expr        Anonymous simple function
Operators in Python Reviewed by Rupesh on 07:56 Rating: 5

No comments:

All Rights Reserved by Technology from Developers Eye © 2014 - 2015
Powered By Blogger, Designed by Aadics
Disclaimers:: The information provided within this blogsite is for general informational purposes only. While we try to keep the information up-to-date and correct, there are no representations or warranties, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the information, products, services, or related graphics contained in this blogsite for any purpose.The author does not assume and hereby disclaims any liability to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from accident, negligence, or any other cause.

Contact Form

Name

Email *

Message *

Powered by Blogger.