学习

https://liaoxuefeng.com/books/python/first-program/input-output/index.html

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