Saturday, October 06, 2018
Python Counter
# collections.Counter lets you find the most common
# elements in an iterable:
>>> import collections
>>> c = collections.Counter('helloworld')
>>> c
Counter({'l': 3, 'o': 2, 'e': 1, 'd': 1, 'h': 1, 'r': 1, 'w': 1})
>>> c.most_common(3)
[('l', 3), ('o', 2), ('e', 1)]
===
https://realpython.com/
Subscribe to:
Posts (Atom)
AI
Despite the benefits of AI we are starving for humanity.
-
It is difficult to create robot that cleans our arbitrary dirty dishes. However , if we put some digital information on dishes (special des...
-
Our parents were arranging their schedule according to sunrise and sunset. They are still consistent in their habit. However, in our generat...
-
Robot Particles Display: Current display devices can show any image for a very cheap price. But it will be very intresting if someone tr...