Answers for "use counter to get least ffrequent lements pyhton"

0

python counter least common

import collections
c = collections.Counter(a=1, b=2, c=3)
n = 2

print c.most_common()[:-n-1:-1]Output[('a', 1), ('b', 2)]
Posted by: Guest on June-20-2020

Python Answers by Framework

Browse Popular Code Answers by Language