简单介绍一点python的佛性。
- python开始支持了连不等式,不用再拆开了。
weight = 30
if 18.5 < weight < 25:
print("BMI is considered 'normal'")
if weight > 18.5 and weight < 25:
print("normal")
print(weight)
结果:
30
if 18.5 < weight < 25:
print("BMI is considered 'normal'")
if weight > 18.5 and weight < 25:
print("normal")
print(weight)
结果:
BMI is considered ‘normal’
normal
20
- python 查看ASCII(美国信息交换标准代码)
print(ord('0'))
print(ord('a'))
print((ord('A')))
3.科学技术法 type()
type(1e-7)