Anonymous user
Non-decimal radices/Convert: Difference between revisions
→{{header|Python}}: factorize
m (→{{header|Python}}: Split long line) |
(→{{header|Python}}: factorize) |
||
Line 848:
=={{header|Python}}==
<lang python>
def baseN(num,b):
return (((num == 0) and "0" )
or ( baseN(num // b, b).lstrip("0")
+
# alternatively:
Line 859 ⟶ 860:
while num != 0:
num, d = divmod(num, b)
result +=
return result[::-1] # reverse
|