#运算符,计算器的底层原理 a=10 b=3 #加上 + print("a+b={}".format(a+b)) #减去 - print("a-b={}".format(a-b)) #乘积 * print("a*b={}".format(a*b)) #除以 / print("a/b={}".format(a/b)) #取余 % print("a%b={}".format(a%b)) #求商 // print("a//b={}".format(a//b)) #求幂 ** print("a**b={}".format(a**b)) #比较算术运算符,比大小,比高低,比真假 # 大于号> # 小于号< # 等于== # 不等于<> # 不等于!= # 大于等于>= # 小于等于<= age=int(input("请输入你的年龄")) if age >= 18 : print("可以谈恋爱了") else : print("未成年人禁止谈恋爱") print("="*20) #逻辑运算符 #and XXX和XXX,左右两边都满足 #or XXX或者XXX,满足其中一个即可 #not 反过来 #白富美 color="白" rich="富" beautiful="美" if color=="白"and rich=="富"and beautiful=="美": print("你是我喜欢的类型") else: print("你是个好人,可是感情的事是不能勉强的")
运算符,计算器的底层原理
最新推荐文章于 2022-11-29 14:34:17 发布