Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Number Base by McRawicz
def checkio(str_number, radix):
digits=[]
i=0
while i64:
digits.append(ord(str_number[i])-55)
else:
digits.append(ord(str_number[i])-48)
if digits[i]>=radix:
return -1
i+=1
number=digits[-1]
i=len(digits)-2
x=radix
while i>=0:
number=number+digits[i]*x
i-=1
x*=radix
return number
Oct. 30, 2016