碼上歡樂
首頁
榜單
標簽
關於
搜索
相關內容
簡體
繁體
在python中對list求和及求積
本文轉載自
查看原文
2015-06-17 12:36
9876
Python
# the basic way
s =
0
for
x
in
range(
10
): s += x
# the right way
s = sum(range(
10
))
# the basic way
s =
1
for
x
in
range(
1
,
10
): s *= x
# the other way
from
operator
import mul reduce(mul, range(
1
,
10
))
×
免責聲明!
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。
猜您在找
prod()函數,接受一個list並利用reduce()求積
python 數組中數字求和是否為零
Python求和
python中的列表(list)
python中強大的list
Python中的基本list操作
Python中List詳解
Python中list的實現
Python中list的比較
python 中對list去重
粵ICP備18138465號
© 2018-2025 CODEPRJ.COM