Pair of gloves
=============

Winter is coming, you must prepare your ski holidays. The objective of this kata is to determine the number of pair of gloves you can constitute from the gloves you have in your drawer.

A pair of gloves is constituted of two gloves of the same color.

You are given an array containing the color of each glove.

You must return the number of pair you can constitute.

You must not change the input array.

Example :
```python
my_gloves = ["red","green","red","blue","blue"]
number_of_pairs(my_gloves) == 2;// red and blue

red_gloves = ["red","red","red","red","red","red"];
number_of_pairs(red_gloves) == 3; // 3 red pairs
```

Source: codewars | Difficulty: EASY
Tags: Data structures

Ad-hoc

Starter code: def number_of_pairs(gloves):
	

Solutions:
from collections import Counter

def number_of_pairs(gloves):
	return sum((c // 2 for c in Counter(gloves).values()))


def number_of_pairs(gloves):
	return sum((gloves.count(color) // 2 for color in set(gloves)))


def number_of_pairs(gloves):
	unique = set(gloves)
	return sum((gloves.count(i) // 2 for i in unique))


def number_of_pairs(gloves):
	return sum((gloves.count(c) // 2 for c in set(gloves)))


from itertools import groupby

def number_of_pairs(gloves):
	return sum([len(list(g)) // 2 for (k, g) in groupby(sorted(gloves))])


from itertools import groupby

def number_of_pairs(gloves):
	return sum((len(list(gp)) // 2 for (_, gp) in groupby(sorted(gloves))))


import collections

def number_of_pairs(gloves):
	return sum((i // 2 for i in collections.Counter(gloves).values()))