All pastes #397005 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-03-16 04:22 UTC
rendered paste body
def count(x,s):
        count=0
        for i in range(len(x)):
                if s == x[i]:
                        count=count+1
                        x[i] = None
        return [s,count]

def mode(x):
        x.sort()
        tags = []
        highmode = [[None,None],None]
        for i in range(len(x)):
                if(x[i] != None):
                        foo = count(x,x[i])
                        tags = tags + [foo]
        return tags

print mode([1,1,2,5,5,2])