1.1 Introduction to Algorithms
发布时间
阅读量:
阅读量
此专栏为浙江大学国际校区生物信息学大三的课程,供期末复习所用,欢迎指正。
1. 算法总览

2. 需要的软件/environment/学习用书
老师推荐:python3、VENV、PIP、Conda、VScode
我自己装的:Pycharm
学习用书:

3. python 基本语法
3.1 numeric
Numeric Type Converstion
"int (x)" converts x to an integer.
"float (x)" converts x to a floating point number.
3.2 string
String Splice
语法:object[start : stop : step]
正负只是决定索引方向
s='2022BMI3'
s[3:] >>> s[2:6] >>> s[-6:-1]
'2BMI3' '22BM' 前闭后开 '22BMI'
count (可对string和list操作)
s='AJKHAUH' or s=['A','H','J','H','A']
s.count('A')
3.3 list
list splice****多维索引
l=[[1,2],[3,4],[5,6]]
l[1][1]
4
3.4 dictionary
Define: d = {'key1': 'value1', 'key2': 'value2', 'key3': 'value3' }
Query: d.get("key1") returns "value1"
Update: d["key1"] = "new_value_1"
全部评论 (0)
还没有任何评论哟~
