0
Program to find frequencies of all elements in a list...?
List manipulation
3 odpowiedzi
+ 1
A simple way to get this, is by iterating over a list of elements with a for loop. To store the results you can use a dictionary.
In this dict the elements will get the keys. If element is not in dict (key), a new key must be created and a value of 1 must be set as value. If key already exists the counter (value) must be incremented by 1.
After the iteration over list, the dict contains key:value pairs.
0
https://docs.python.org/3/library/collections.html
https://www.jquery-az.com/python-collections-counter-explained-5-examples/