Python 编程与环境笔记:系列目录

简单介绍一点python的佛性。

  1. python开始支持了连不等式,不用再拆开了。
1
2
3
4
5
6
7
8
9
weight = 30

if 18.5 < weight < 25:
print("BMI is considered 'normal'")

if weight > 18.5 and weight < 25:
print("normal")

print(weight)

结果:
30

1
2
3
4
5
6
7
8

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 与科学计数法配图

  1. python 查看ASCII(美国信息交换标准代码)
1
2
3
print(ord('0'))
print(ord('a'))
print((ord('A')))

Python 小语法:链式比较、ASCII 与科学计数法配图

3.科学技术法 type()

1
type(1e-7)

Python 小语法:链式比较、ASCII 与科学计数法配图