Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Number Base by m.dziardziel
def checkio(str_number, radix):
number=str_number[::-1]
potega=1
liczba=0
for a in number:
if ord(a)>57:
cyfra=ord(a)-55
else:
cyfra=a
if int(cyfra)>radix-1:
return -1
print(cyfra)
liczba=liczba+int(cyfra)*potega
potega=potega*radix
return liczba
Nov. 18, 2016