Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Numbers Factory by szymonkukla1
def checkio(number):
i = 9
x = []
while(i >= 2):
if(number%i == 0):
number = number / i
x.append(i)
i = 9
else:
i = i - 1
if(number >= 10):
return 0
y = []
y = sorted(x)
i = len(y) - 1
m = 0
liczba = 0
while(i >= 0):
liczba += y[m] * 10**i
m = m + 1
i -= 1
return(liczba)
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert checkio(20) == 45, "1st example"
assert checkio(21) == 37, "2nd example"
assert checkio(17) == 0, "3rd example"
assert checkio(33) == 0, "4th example"
assert checkio(3125) == 55555, "5th example"
assert checkio(9973) == 0, "6th example"
Nov. 14, 2016