下表列出了所有支持Python語言的算術運算符。
Operator |
Description |
Example |
+
Addition - Adds values on either side of the operator
a + b will give 30
-
Subtraction - Subtracts right hand operand from left hand operand
a - b will give -10
*
Multiplication - Multiplies values on either side of the operator
a * b will give 200
/
Division - Divides left hand operand by right hand operand
b / a will give 2
%
Modulus - Divides left hand operand by right hand operand and returns remainder
b % a will give 0
**
Exponent - Performs exponential (power) calculation on operators
a**b will give 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.
9//2 is equal to 4 and 9.0//2.0 is equal to 4.0
相信了解了上面的應用,對你用python操作一些算術運算有幫助
*