Aug-21-2019, 10:51 AM
(Aug-21-2019, 10:22 AM)rachyioli Wrote: what I need now is to order them from the ones that happened the most in the list
You can extend solution provided by buran with .most_common method. If you want regular dict you can convert:
>>> spam.most_common(len(spam.keys())) [(3, 4), (1, 2), (2, 2), (4, 1), (5, 1), (6, 1)] >>> dict(spam.most_common(len(spam.keys()))) {3: 4, 1: 2, 2: 2, 4: 1, 5: 1, 6: 1}
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.