'Why is my function looping? And not return answer

This kata from codewar is not working!

#(tribonacci([1, 2, 3], 10), [1, 2, 3, 6, 11, 20, 37, 68, 125, 230])
def tribonacci(signature, n):
    i = 0
    while len(signature) != n:
        signature.append(sum(signature[i:i + 3]))
        i += 1
    return signature


Solution 1:[1]

Your code works just fine. Perhaps you forgot to print so you didn't see the result?
For example, try this:

def tribonacci(signature, n):
    i = 0
    while len(signature) != n:
        signature.append(sum(signature[i:i + 3]))
        i += 1
    return signature

print(tribonacci([1, 2, 3], 10))

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Yuval.R