op
/ |
- Performs Division on the operands. Divides the left operand by the right operand |
- 12 / 3 = 4 |
-
-
- Note: When two integers are used, the result differs between Python 2 and Python 3. |
- 5 / 2 = 2 in Python 2 |
- 5 / 2 = 2.5 in Python 3 |
+ Performs 'Floating Point' Division on the operands. Divides the left operand by the right operand (Note: When two INTEGERS are used, the result differs between Python 2 and Python 3.) |
+ 12 / 3 = 4 5 / 2 = 2 (Python 2) 5 / 2 = 2.5 (Python 3) |
% |
@@ -64,8 +59,8 @@ Consider the expression, “a = 2 + 3”. Here, `2` and `3` are the op
// |
- Performs a Floor Division operation. Returns the integral part of the quotient obtained after diving the left operand by the right operand |
- 18 // 5 = 3 |
+ Performs a 'Floor/Integer' Division operation. Returns the integral part of the quotient obtained after diving the left operand by the right operand |
+ 18 // 5 = 3.0 |
@@ -85,33 +80,33 @@ A comparison or relational operator is used to compare two operands to determine
> |
- Returns True if the left operand is greater than the right operand Returns False otherwise |
- 12 > 3 returns True |
+ Returns 'True' if the left operand is greater than the right operand Returns 'False' otherwise |
+ 12 > 3 returns 'True' |
< |
- Returns True if the right operand is greater than the left operand Returns False otherwise |
- 12 < 3 returns False |
+ Returns 'True' if the right operand is greater than the left operand Returns 'False' otherwise |
+ 12 < 3 returns 'False' |
== |
- Returns True if both the operands are equal Returns False otherwise |
- 12 == 3 returns False |
+ Returns 'True' if both the operands are equal Returns 'False' otherwise |
+ 12 == 3 returns 'False' |
>= |
- Returns True if the left operand is greater than or equal to the right operand Returns False otherwise |
- 12 >= 3 returns True |
+ Returns 'True' if the left operand is greater than or equal to the right operand Returns 'False' otherwise |
+ 12 >= 3 returns 'True' |
<= |
- Returns True if the right operand is greater than or equal to the left operand Returns False otherwise |
- 12 <= 3 returns False |
+ Returns 'True' if the right operand is greater than or equal to the left operand Returns 'False' otherwise |
+ 12 <= 3 returns 'False' |
!= |
- Returns True if both the operands are not equal Returns False otherwise |
- 12 != 3 returns True |
+ Returns 'True' if both the operands are not equal Returns 'False' otherwise |
+ 12 != 3 returns 'True' |