aboutsummaryrefslogtreecommitdiff
path: root/challenge-002/zapwai/python/ch-2.py
blob: d26bd231ebdd3b160574c555bc1be092b23a6cf1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
alph = "0123456789abcdefghijklmnopqrstuvwxy"

def to10(s):
    return int(s, 35)

def to35(s):
    q = s;
    o = ""
    while ( q > 0 ):
        rem = q % 35
        o = alph[rem] + o
        q //= 35
    return o

print("Input: (base-10) 100\nOutput: ", to35(100))
print("Input: (base-35) 2u\nOutput: ", to10("2u"))