Arithmetic Operators :
x=70
y=50
Operators | Description | Example |
+ | Adds the operands | x+y=120 |
- | Subtract the operand on the right from operand from left | x-y=20 |
* | Multiples the two operands | x*y=3500 |
/ | Divide operand on the left side of the operand on right side | x/y=1.4 |
% | Modulus : It will perform the division first and then return the reminder | x%y=20 |
// | Floor Division . Divide the operand and return the quotient. It will removes digits after the decimal point. | x//y=1 |
** | Perform the exponential operation | x**y=x to the power y |
Comparison Operators :
x=70
y=50
Operator | Description | Example |
== | Return true if the two values are exactly same | x==y false |
!= | Return True if the values are not equal . | x!=y true |
> | Turn if the operand on the left side is greater than the operand on the right side . | x>y true |
< | True if the operand on the right side is greater than the left side . | x<y false |
>= | Return true if the operand on left side is either greater or equal to the right side operand | x>=y true |
<= | Return true if the operand on the right side is either greater or equal to that of the left side operand | X <=y false |
Comparison operators are mainly used in the loops expression(conditions)