拓展阅读:回归测试
在求平方根的时候 假如是小于1的浮点数。 将其取值范围 high=max(x,1.0)取其
中的最大值。数大于1.0
拓展阅读:牛顿和拉浮生 求导数的方程
guess J+1=guess j - f(guess)/2guess
计算机 not god。
浮点数的溢出和下溢
toples and strings in immutable
list is mutable
可以包含数组 字符串
list 是可变数组
例如:
Techs=['MIT','CalTech']
Ivys=['H','Y','B']
univs=[]
method.append(method1)
univs.append(Techs)
print univs:
[['MIT','CalTech']]
and univs.append(Ivys)
print univs:
[['MIT','CalTech'],['H','Y','B']]
if use array+array
ex:
univs=Techs+Ivys
print univs:
['MIT','CalTech','H','Y','B']
array.remove('name of object')
like:
univs.remove('MIT')
改变数组下标的指向绑定
ex:
univs[1]=-15
L1=[1,2,3]
L2=L1
L2实际上和L1绑定到同一对象了。
L1[0]=4
L2=[4,2,3]
Dictionaries
key value 结构 无序的 hashins
mutable not ordered generaliecd
用伪代码来写清楚代码的结构和控制流
inputOk=False
while not inputOk:
base=input("Enter base:")
if type(base)=type(1.0) :input=True //判断输入是否是浮点数
aggorithm:
choice of algorithm and how to map a problem into a class of
algorithms of some efficiency
提升效率:
空间:运行某个指定程序时需要占用计算机的多少内存
时间:实现一个根据输入大小进行计算的方法需要几个步骤呢?
random access model: 我们取得内存中任何位置的变量的时间是恒定的
PS:两位老师说课好幽默啊。拿自己和harvard开各种玩笑。