python的基本操作运算符

#幂次运算 **
mici = 1
while mici <= 9:
    print(2**mici,end=" ") #打印2的n次幂
    mici += 1
#取整运算 //
print("
取整运算:5//3 = ",5//3)

'''
逻辑运算:
或:or
与:and
非:not
优先级问题:
有括号先算括号里边的,算完括号里边的,先算not ,再算and,最后算or
如果出现x or y,当x是0的时候输出结果就是y,否则就是x
如果出现x and y,当x是0的时候,输出的是0,如果不是0,输出的就是y
'''
print(3 or 2)
print(0 or 2 or 3 or 4)
print(1 and 2 and 3)
print(0 and 3 and 2)
原文地址:https://www.cnblogs.com/boost/p/13229385.html