####
Python Arithmetic Operators
Assume variable a holds 10 and variable b holds 20, then −
[ Show Example ]
Operator | Description | Example |
---|---|---|
+ Addition | Adds values on either side of the operator. | a + b = 30 |
- Subtraction | Subtracts right hand operand from left hand operand. | a – b = -10 |
* Multiplication | Multiplies values on either side of the operator | a * b = 200 |
/ Division | Divides left hand operand by right hand operand | b / a = 2 |
% Modulus | Divides left hand operand by right hand operand and returns remainder | b % a = 0 |
** Exponent | Performs exponential (power) calculation on operators | a**b =10 to the power 20 |
// | Floor Division - The division of operands where the result is the quotient in which the digits after the decimal point are removed. But if one of the operands is negative, the result is floored, i.e., rounded away from zero (towards negative infinity): |
No comments:
Post a Comment