算数运算符
如下图:
举例:
a=7
b=3
print(a+b)
print(a-b)
print(a*b)
print(a/b)
print(a%b)
print(a**b) #指数
print(a//b) #相除取证
比较运算符
举例:
a,b=10,5
print(a==b)
print(a!=b)
print(a>=b)
print(a<=b)
print(a>b)
print(a<b)
逻辑运算符
如下图:
举例:
a,b,c,d=23,18,10,3
print(a+b>c and c<d) #false
print(c>d and a>b) #true
#or--有一个为真就是真
print(a<b or b>d) #true
print(a<b or b<d) #false
#not 取反
print(not a>b)
优先级:
() -> not ->and ->or
赋值运算符
如下图: