Consider a string '1234'. You need a function which generates all the rotations: '1234', '3412', '4123', '2341'. I created a simple test suite:
assert rotations('123') == set(['123', '231', '312'])
assert rotations('111') == set(['111'])
assert rotations('197') == set(['197', '971', '719'])
What is the pythonic way to do that? I finished with code below
def rotations(num):
    str_num = str(num)
    result = set()
    for mid in xrange(len(str_num)):
        result.add(
            str_num[mid:] + str_num[:mid]
        )
    return result
 
     
     
     
    