Sales by Match : HackerRank Solution in Python

Solution in Python 3

def sockMerchant(n, ar):
countOfSocks = []
for sock in set(ar):
countOfSocks.append(ar.count(sock))
return sum([i//2 for i in countOfSocks])

Explanation

pretending to teach is one of the best way to learn.