a = "rrr"
b = "sss""sddd"
#有空格
print(a, b)
#完美链接
print(a + b)
#bytes 字节串
st = bytes('我爱python',encoding = 'utf-8')
print(st)#b'\xe6\x88\x91\xe7\x88\xb1python'
print(st.decode('utf-8'))#我爱python
price = 108
#%格式化输出
print("the book's price is %s" % price)
user = "Charli"
age = 8
#格式化字符串中有两个占位符,第三部分也应该提供两个变量
print("%s is a %s years old boy" % (user, age))#Charli is a 8 years old boy
nums = 30
#最小宽度为6, 左边补0
#-指定左对齐 +表示数值总要带着符号 0表示不补充空格 补充0
print("num2 is: %06d" % nums)
# num2 is: 000030
print("num2 is: %+06d" % nums)
# num2 is: +00030
print("num2 is: %-06d" % nums)
# num2 is: 30
print(5 ** 2)#平方
print(4 ** 3)#立方
print(4 ** 0.5)#开根号
# and 与
# or 或
# not 非
# 三目运算符
a = 5
b = 3
st = "a大于b" if a > b else "a不大于b"
#输出a 大于 b
print(st)
print(a) if a > b else print(b)
c = 5
d = 5
#下面将输出"c等于d"
print("c大于d") if c > d else(print("c小于d") if c < d else print("c等于d"))