Answers for "conversion of int to a specified base number"

0

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)))
Posted by: Guest on August-23-2021

Code answers related to "conversion of int to a specified base number"

Python Answers by Framework

Browse Popular Code Answers by Language