In this kata, your task is to identify the pattern underlying a sequence of numbers. For example, if the sequence is [1, 2, 3, 4, 5], then the pattern is [1], since each number in the sequence is equal to the number preceding it, plus 1. See the test cases for more examples.
A few more rules :
pattern may contain negative numbers.
sequence will always be made of a whole number of repetitions of the pattern.
Your answer must correspond to the shortest form of the pattern, e.g. if the pattern is [1], then [1, 1, 1, 1] will not be considered a correct answer.
def find_pattern(seq):
    xs = [b-a for a, b in zip(seq, seq[1:])]
    return next((
        xs[:i]
        for i in range(1, len(xs) // 2 + 1)
        if xs[:i] * (len(xs) // i) == xs
    ), xs)
def find_pattern(seq):
    xs = [b-a for a, b in zip(seq, seq[1:])]
    return next((
        xs[:i]
        for i in range(1, len(xs) // 2 + 1)
        if xs[:i] * (len(xs) // i) == xs
    ), xs)