day4——Python运算符

运算符
    a) 算术运算符
 

 

 

    b)关系运算符
 

 

True 真,非0,False <=0 假
 
a = 10
b = 20
b += a
b += a
c = 100
c -= a
print(b)
print(c)
print(a ==b)
print(a<=b)
 
print(a ==b) #判断a是否等于b
print(a<=b)
第一个结果返回False,第二个返回True结果
 
 
    c)逻辑运算符
 

 

print((a + b < c) and a < c)
如果左边和右边都成立,才返回True结果
print((a + b > c) or a < c)
有一个真就返回True结果
优先递减级别:
()---->取反not---->与and---->或or
 
 
 
 
 
 
posted @ 2017-10-19 11:59  落后乞丐  阅读(171)  评论(0)    收藏  举报