python3的运算符,,1,Python的加


1,Python的加,减,乘。除
>>> 2 + 24>>> 50 - 5*620>>> (50 - 5*6) / 45.0>>> 8 / 5 # division always returns a floating point number1.6
2,Python的取余,取整
>>> 17 / 3  # classic division returns a float5.666666666666667>>>>>> 17 // 3  # floor division discards the fractional part5>>> 17 % 3  # the % operator returns the remainder of the division2>>> 5 * 3 + 2  # result * divisor + remainder17
3,Python的幂运算
>>> 5 ** 2  # 5 squared25>>> 2 ** 7  # 2 to the power of 7128
4,Python的赋值运算
>>> width = 20>>> height = 5 * 9>>> width * height900

python3的运算符

评论关闭