def majority(A): min = len(A)/2.0 counts = {} for x in A: if x in counts: counts[x] += 1 else: counts[x] = 1 a = max(counts.iteritems(), key = lambda x: x[1]) if a[1] > min: print "The winner is:", a[0] else: print "There is no winner"