언어/파이썬
10진수를 n진수로 만들기
hazel_
2021. 4. 3. 14:47
def convert(num, base):
tmp="0123456789ABCDEF"
q,r = divmod(num,base)
if q==0:
return tmp[r]
else:
return convert(q, base)+tmp[r]