# -*- coding:utf-8 -*- # 运算符 # 算术运算符 a = 1 b = 2 print (a + b) # print a - b # print a * b # print a / b a = 1.0 print (a / b) # -------------------------------------- # print a // b # 你就当它是除法,取整(不四舍五入)就好 a = 2 # print a ** b # a的b次方 a = 6 b = 4 # print a % b a = 1 b = 2 # print a > b # print a < b # print a >= b # print a <= b # print a == b # 逻辑运算符 # and && # or || # not ! # in 在指定容器里找到返回true 否则false # not in 在指定容器里未找到返回true 否则false user_name = "alan" passward = "123456" if user_name == "alan" and passward == "123456": print ("success") else: print ("false")
分类: Python
0 条评论