Python Tokens - Operators

Operators - Tokens that trigger computation when applied to variables and other objects in a expression. Variable and expression to which the operators are applied are called operands.
Example:- 2+3 here 2,3 are operands and + is operator.
1. Unary Operators -  It operates on only one operand. Example:-
OperatorNameExample
+Unary Plus+10, 23E+2
-Unary Minus-4.3, -2.3E-1
~Bitwise complement~3
notLogical negationnot 2
2. Binary Operators - It requires two operators to operate upon.

OperatorNameExample
+Addition2+3 = 5
-Subtraction2-3=-1
*Multiplication2*3=6
/Division2/3 = 0.66666666
%Remainder2%3 = 2
**Exponent2**3 = 8
//Floor division55//2 = 27

Comments

Popular posts from this blog

Python Tokens

Descriptive Statistics - count & sum