Write a Python program to sum of all counts in a collections


Introduction

Write a Python program to sum of all counts in a collections. I have used python 3.7 compiler for debugging purpose.


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

  1. import collections
  2. num = [1,2,3,4,5,6]
  3. print(sum(collections.Counter(num).values()))

Result

python language techstudy.org

     





Related Topics




Popular Posts