分类,回归
Integer (int): discrete and continuous
Floating point numbers are decimal values or fractional numbers like 133.5, 2897.11,
| Decimals can suffer from their own precision issues, but generally, decimals are more precise than floats.
Booleans represent one of two values: True or False
Type is also a data category
e.g.
print (type (2,2))
---
<class: "float">
Built-in operators
@ 举证乘法;**次方 (3**2 = 9); %模运算,余数预算符 (5 % 2 = 1 #5/2的余数是1)
= 一个等于号是赋值( a = 1),== 是等于 (2 == 2)
! = : 不等于; // interger division (整除,计算结果是整数,舍弃小数位直接砍掉
/ 一个斜杠是浮点式除法,计算结果为float ( 2 / 1 = 2.0)
+=:先计算再赋值 ( c += 2 # c= c+2)
取余:以除数为积,and 被除数为积
注意 % 与 math.fmod() 的区别,详见:Modulo operation
运算顺序
结合率 5-4-3 加减乘除是从左往右算
次方运算时从右往左算 :4**3**2 = 先算3的2次方,再算4的(3**2)次方
8793

被折叠的 条评论
为什么被折叠?



