python3.x中的reduce函數和python2.x不在同一個庫裏了,需要導入:from functools import reduce
from functools import reduce
print('the total is:',reduce((lambda x,y:x + y),range(5)))
運行結果:
the total is: 10
python3.x中的reduce函數和python2.x不在同一個庫裏了,需要導入:from functools import reduce
from functools import reduce
print('the total is:',reduce((lambda x,y:x + y),range(5)))
運行結果:
the total is: 10
繼續運行 🥋 回憶上次內容 上上次 真寫了 萬行 代碼 這 萬行 代碼 都是寫在 明面 上的 這次 使用git命令 下載了 github上面的倉庫