2018年1月11日 星期四

Python: Sum of all counts in a collections

Python: Sum of all counts in a collections

Python Basic: Exercise-125 with Solution

Write a Python program to sum of all counts in a collections.
Sample Solution:-
import collections
num = [2,2,4,6,6,8,6,10,4]
print(sum(collections.Counter(num).values()))
============ RESTART: F:/Python_APSC/py-ex-basic-125.py =============
9
>>> 

沒有留言:

張貼留言

結合桌面視窗介面 (GUI)、雲端資料庫與社群通訊推播的自動化氣象監控系統

視窗介面 (GUI)、雲端資料庫與社群通訊推播的自動化氣象監控系統 這份 gui_app_timer.py 程式是一個 結合桌面視窗介面 (GUI)、雲端資料庫與社群通訊推播的自動化氣象監控系統 。 整體架構採用 事件驅動 (Event-Driven) 與 多執行緒非同步設計...