Averages/Mode: Difference between revisions

Content added Content deleted
Line 1,246: Line 1,246:
=={{header|Python}}==
=={{header|Python}}==
The following solutions require that the elements be ''hashable''.
The following solutions require that the elements be ''hashable''.
{{works with|Python|2.5, 2.6 & 3.1}}
{{works with|Python|2.5+ and 3.x}}
<lang python>>>> from collections import defaultdict
<lang python>>>> from collections import defaultdict
>>> def modes(values):
>>> def modes(values):
Line 1,260: Line 1,260:
[1, 4]</lang>
[1, 4]</lang>


{{works with|Python|3.1}}
{{works with|Python|2.7+ and 3.1+}}
<lang python>>>> from collections import Counter
<lang python>>>> from collections import Counter
>>> def modes(values):
>>> def modes(values):