I found an interesting problem on https://www.codewars.com/kata/557592fcdfc2220bed000042:
### Task:

You have to write a function `pattern` which creates the following pattern (See Examples) upto desired number of rows.

If the Argument is `0` or a Negative Integer then it should return `""` i.e. empty string.

### Examples:

`pattern(9)`:

    123456789
    234567891
    345678912
    456789123
    567891234
    678912345
    789123456
    891234567
    912345678

`pattern(5)`:

    12345
    23451
    34512
    45123
    51234

Note: There are no spaces in the pattern

Hint: Use `\n` in string to jump to next line

I tried it in Python, but could not do it. Can you solve it?
from collections import deque

def pattern(n):
    result = []
    line = deque([str(num) for num in range(1, n + 1)])
    for i in range(n):
        result.append("".join(line))
        line.rotate(-1)
    return "\n".join(result)