Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python convert number to base

def numberToBase(n, b):
    if n == 0:
        return [0]
    digits = []
    while n:
        digits.append(int(n % b))
        n //= b
    return digits[::-1]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #convert #number #base
ADD COMMENT
Topic
Name
2+9 =