#_*_coding:utf-8_*_
# 基本运算符
# 以下假设变量 a = 10, b = 20
# 算术运算
'''
print(a + b) # 30
print(a - b) # -10
print(a / b) # 0.5
print(a // b) # 0
print(a % b) # 10
print(2 ** 3) # 8 2的三次方
'''
# 比较运算
'''
比较运算:只能在同类型之间进行,其中int与float同属于数字类型
(统称 无数字类型)
print(10 > 3.1) # True
print(10 >= 10) # True
(<,<=,同上)
print(a == b) #False
print(a != b) #True
print(a <> b) #True
'''
# 赋值运算
'''
# 增量赋值
age = 18
age = age +1
age += 1
print(age) # 20
# -=, *=, /=, %=, **=, //=
# 链式赋值
x = 1
y = x
z = x
x = y = z = 1
print (id(x),id(y),id(z)) #4538100736 4538100736 4538100736
#id相同
# 交叉赋值
a = 10
b = 20
a,b = b,a
print(a, b) # 20 10
# 解压赋值
age = [10,11,12]
boy1 = age[0]
boy2 = age[1]
boy3 = age[2]
boy1,boy2,boy3 = age
*等号右面包含的值的个数必须与等号左边变量名的个数一致
print(boy1,boy2,boy3) # 10 11 12
boy1,_,_= age # _ 充当占位符
boy1,*_ = age # *_无穷多个
print(boy1) # 10
'''
# 逻辑运算
'''
逻辑运算:and, or, not
and : 连接左右两个条件,两个条件必须都成立,最后结果为True
从左往右运算,只要有条件为假,此条件之后的条件不运算
or : 连接左右两个条件,两个条件只要有一个成立,结果就为True
从左往右运算,只要有条件为真,此条件之后的条件不运算
not :取反
e.g. print((not 1>3 and (False or True)) or (False and True))
# True
'''
# 身份运算
'''
is 与 ==
'''