curriculum/challenges/english/blocks/daily-coding-challenges-python/69b559d2903b9e4afe9075f8.md
Given a positive integer, determine if it, or any of its rotations, is evenly divisible by its digit count.
A rotation means to move the first digit to the end. For example, after 1 rotation, 123 becomes 231.
0 (the given number) first."none" if not.get_rotation(123) should return 0.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_rotation(123), 0)`)
}})
get_rotation(13579) should return 3.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_rotation(13579), 3)`)
}})
get_rotation(24681) should return "none".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_rotation(24681), "none")`)
}})
get_rotation(84138789345) should return 6.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_rotation(84138789345), 6)`)
}})
def get_rotation(n):
return n
def get_rotation(n):
s = str(n)
digit_count = len(s)
current = s
for i in range(digit_count):
if int(current) % digit_count == 0:
return i
current = current[1:] + current[0]
return "none"