数字类型的运算
1. 一元操作符
# +-*/
x = 1
y = 2
print(x*y) # 2
# # % 取余
print(3%4) # 3
# # // 地板除,整除
print(3//4) # 0
# # ** 幂
print(2**10) # 1024
print(pow(2,10)) # 1024
2. 二元操作符
x = 2
# x = x +2 # x+=2
x+=2
x*=2
x%=2
print(x) # 0
a = 2.3
b = 2.0
c = 2
print(a+c) # 4.3
a = 0.1
b = 0.2
c = 0.3
print(a+b) # 0.30000000000000004
print(round(a+b,2)) # 0.3
print(a+b == 0.3) # False
print(a+c == 0.4) # True
3. 通用方法
print(abs(-1)) # 绝对值 # 1
print(divmod(10,3)) # 第一个商,第二个余数 # (3,1)
print(divmod(15,4)) # (3,3)
print(max(10,11,12,1123,12312312,111.0)) # 最大值 # 1231312
print(min(10,11,12,1123,12312312,111.0)) # 最小值 #10