ググったら出てくるような気もしますが。
Python
1from collections import Counter
2
3tmp_list = [1, 1, 1, 1, 0, 1, 1]
4counter = Counter(tmp_list)
5
6print(counter.most_common()[0][0])
追記
どうやら次の方法の方が簡潔なよう。
Python
1from statistics import mode
2
3tmp_list = [1, 1, 1, 1, 0, 1, 1]
4print(mode(tmp_list))
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/01/11 09:23
2018/01/11 09:43
2018/01/11 09:50 編集
2018/01/11 09:54
2018/01/11 09:58 編集
2018/01/11 10:23 編集
2018/01/11 10:37