Family Day update

This commit is contained in:
Ingy döt Net 2020-02-17 23:21:07 -08:00
parent aac6731f2c
commit 9ad63ea473
2442 changed files with 39761 additions and 8255 deletions

View file

@ -3,15 +3,3 @@ def baseN(num,b):
return (((num == 0) and "0" )
or ( baseN(num // b, b).lstrip("0")
+ digits[num % b]))
# alternatively:
def baseN(num,b):
if num == 0: return "0"
result = ""
while num != 0:
num, d = divmod(num, b)
result += digits[d]
return result[::-1] # reverse
k = 26
s = baseN(k,16) # returns the string 1a

View file

@ -0,0 +1,10 @@
digits = [[ch] for ch in "0123456789abcdefghijklmnopqrstuvwxyz"]
def baseN(num, b):
if num == 0:
return "0"
result = []
while num != 0:
num, d = divmod(num, b)
result += digits[d]
return ''.join(result[::-1])