学习
https://liaoxuefeng.com/books/python/first-program/input-output/index.html
- windows下运行python需要在powershell中运行,不能在cmd中运行。
- 交换模式的退出是exit()。
- 字符串可以用单引号或者双引号括起来。
- 2的10次方: 2**10。
- 为了方便计数,Python的数字允许用
_
来隔开。比如1000000000000可以写成1_000_000_000_000。0x1020304写成0x1020_3040。 - list: l = [1, 2, 3, ‘a’], tuple: t = (1, 2, 3), tuple是不可变的list,1个元素的tuple要加逗号: t = (1,)。
- 条件判断:if … elif … else …
- 模式匹配: match … case …
- dict: d = {‘a’: 1, ‘b’: 2}, set: s = {1, 2, 3}