python_17_数据运算

#//取整除,返回商的整数部分
print(9//2)
print(10/3.3)
print(10//3.0)
#<>与!=都为不等于
#and 与    例(a and b)
#or 或
#not非
#in  ,not in判断在与不在
a=[1,2,3,4]
if 1 not in a:print("sdfdsf")
if 31 not in a:print('qwert')
#is      is not
b=[1,2,3,4]
print(type(a) is list)
print(type('333') is int)
#   ^按位异或   ~按位取反
m=40      #40=00101000
n=33      #33=00100001
print(m^n)#9= 00001001
print(~m)#215= 11010111,-41=215-256
#  <<左移,左移1位相当于乘以2,左移2位相当于乘以4   >>右移,右移1位相当于除以2,右移2位相当于除以4
print(64<<1,64<<2)
print(64*2,64*4)

print(64>>1,64>>2)
print(64/2,64/4)

  

posted @ 2018-01-03 09:26  耐烦不急  阅读(214)  评论(0编辑  收藏  举报