Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

conversion of int to a specified base number

n = int(input())
base = 3

if n == 0:
    print(0)
nums = []
while n:
    n, r = divmod(n, base)
    nums.append(str(r))
print(''.join(reversed(nums)))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #conversion #int #base #number
ADD COMMENT
Topic
Name
6+8 =