Family Day update
This commit is contained in:
parent
aac6731f2c
commit
9ad63ea473
2442 changed files with 39761 additions and 8255 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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])
|
||||
Loading…
Add table
Add a link
Reference in a new issue