If you don't have to implement your own Counter, you can use the Counter from the
As mentioned before, tuples are immutable and hashable objects, which can be used as keys for a dict.
In your case, it's just
Btw. you've used list as a name for the list.
Give it another name.
collections
module.As mentioned before, tuples are immutable and hashable objects, which can be used as keys for a dict.
In your case, it's just
Counter(your_list)
.Btw. you've used list as a name for the list.
list
is a type and you've overwritten it with your list.Give it another name.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!