Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Number Base by jacekgrycza
def d(i):
if i.isdigit():
return int(i)
if i.isalpha():
return ord(i)-55
def checkio(n, radix):
for j in n:
if d(j)>=radix:
return -1
p=0
e=1
for j in n[::-1]:
p=p+e*d(j)
e=e*radix
return p
Oct. 30, 2016