Python 函数 通过分而治之的方法解决问题是一种很自然的思路.函数就是将解决特定问题的方法进行抽象. def fibs(num): 'calculate the first num th fib num' result=[0,1] for i in range(num-2): result.append(result[-1]+result[-2]) return result fibs(10) [0, 1, 1, 2, 3, 5, 8, 13, 21, 34] 文档化函数 通过在函数def后…
1 time #时间与日期 import time; # This is required to include time module. ticks = time.time() print ("Number of ticks since 12:00am, January 1, 1970:", ticks) localtime = time.localtime(time.time()) print ("Local current time :", localtime…