All pastes #811877 Raw Edit

Something

public python v1 · immutable
·published 2007-12-11 09:14 UTC
rendered paste body
def toDecimal(n, base=2):    """Convert integers from any base to dec"""    rawr, p, converted, answer, m = [], 0, 0, 0, 0    if not n:        print "no arguments given"    if (type(n) != int):        print "can't convert non integers dumbass"    if (base is 16 or 8):        working = str(n)[::-1]        limit = len(working)        while not converted:            while (p < limit):                workingint = int(working[p])                workingint = workingint*base**p                rawr.append(workingint)                p = p + 1            for i in rawr:                m = (i+answer)                answer = m            converted = 1        print answer    if (base is 2):        passtoDecimal(2345, 8)