Token (OPERATOR)
Operator: Operator are tokens that does computation(calculation) with designated or given values in expression. Operators when applied on operands form an expression.
Operand: Operand is the value or variable on which calculation is performed.
Operators are can be classified in three categorize:
1. Arithmetic Operator: Arithmetic operators are those operators which are used for arithmetic or mathematical calculations. In Python, the arithmetic operators are:
- Addition (+) : It is used to sum two operands.
- Subtraction (-) : It gives difference between two operands.
- Multiplication ( * ) : It gives us product of the two operands.
- Division (/) : It gives us Quotient of the two operands.
- Floor Division ( // ) : It gives us quotient of two operands(without fractional part).
- Modules ( % ) : It gives us integer remainder after division of 'a' by 'b' -(a % b).
- Exponent ( ** ) : It gives us product of 'a' by itself 'b' times(a to the power of b).
2. Relational Operator : Relational operators are those operators which are used to compare aarithmatical and logical expressions. It is also known as ' Comparison Operator'.
- Greater than(>) : Gives result true if the left operand is greater than the right operand.
- Less than (<) : Gives result true if the left operand is less than the right.
- Equal to (= =) : Gives result true if both operand are equal.
- Not Equal to (!=) : Gives result true if both operand are not equal.
- Greater than/Equal to ( >=) : Gives result true if left operand is greater than or equal to the right operand.
- Less than/ Equal to (<=) : Gives result true if the left operand is less than or equal to the right operand.
1. Logical AND (and) : this operator is written as 'and'. It combines two expression into one. The resulting expression evaluates to 'True' only if both the conditions satisfies to 'true'.
2. Logical OR (or) : This operator is written as 'or'. It combines two expressions into one. The resulting expression evaluates to 'True' when either of the conditions satisfies to 'True'.
A very nice designed blog with nice explanation of topics👍👍
ReplyDeleteTq Vaibhavi. KEEP LEARNING
ReplyDelete