print('test1 \" test1') # 对引号在需要保持不变进行输出的字符前面进行转义\ print("test2" "开始") print('''test3 test4''') # 单双三引号都可以,三引号换行时不会多加引号 # 简单的数据类型 a = "大家好,我是派更大星" b = " " c = None # 它是不存在,在python几乎不用 d = "null" e = 123 data_folat = 123.123 print(type(c)) print(type(d)) # 运算符 --> 算数运算符 、比较运算符 、 赋值运算符 、 成员运算符 、身份运算符
# 比较运算符
data_1 = 5
data_2 = 10
data_3 = data_1 + data_2
print(data_3)
result = (data_1 ==data_2)
print(result)
result = (data_1 !=data_2)
print(result)
result = (data_1 < data_2)
print(result)
# 赋值运算符
count = 0 count += data_1 print("扫描第一件物品,总价格为",count) count += data_2 print("扫描第二件物品,总价格为",count) count += data_3 print("扫描第三件物品,总价格为",count) print(data_3 / data_1) print(data_3 // data_1) basic_data = 10 mi_times = 3 print(basic_data ** mi_times)
# 逻辑运算符 height = 188 age = 30 print(height == 188 and age > 25) print(height < 188 or age > 25) print(not(height == 188))