If you have completed the Tribonacci sequence kata, you would know by now that mister Fibonacci has at least a bigger brother. If not, give it a quick look to get how things work.

Well, time to expand the family a little more: think of a Quadribonacci starting with a signature of 4 elements and each following element is the sum of the 4 previous, a Pentabonacci (well *Cinquebonacci* would probably sound a bit more italian, but it would also sound really awful) with a signature of 5 elements and each following element is the sum of the 5 previous, and so on.

Well, guess what? You have to build a Xbonacci function that takes a **signature** of X elements *- and remember each next element is the sum of the last X elements -* and returns the first **n** elements of the so seeded sequence.

```
xbonacci {1,1,1,1} 10 = {1,1,1,1,4,7,13,25,49,94}
xbonacci {0,0,0,0,1} 10 = {0,0,0,0,1,1,2,4,8,16}
xbonacci {1,0,0,0,0,0,1} 10 = {1,0,0,0,0,0,1,2,3,6}
xbonacci {1,1} produces the Fibonacci sequence
```

Difficulty: introductory

Starter code:

def Xbonacci(signature,n):
	

Solutions:
def Xbonacci(signature,n):
    output, x = signature[:n], len(signature)
    while len(output) < n:
        output.append(sum(output[-x:]))
    return output

def Xbonacci(signature,n):
    length = len(signature)
    while len(signature) < n:
        signature.append(sum(signature[-length:]))
    return signature[:n]

def Xbonacci(sig, n):
  res = sig[:n]
  for i in range(n - len(sig)): res.append(sum(res[-len(sig):]))
  return res

def Xbonacci(signature,n):
    l = len(signature)

    for i in range(l, n):
        signature += [sum(signature[i-l:i])]
    return signature[:n]

def Xbonacci(signature,n):
    l = len(signature);
    for i in range(n - l):
        signature.append(sum(signature[-l:]));
    return signature[:n];

def Xbonacci(signature, n):
    result = []
    for i in range(n):
        signature.append(sum(signature))
        result.append(signature.pop(0))
    return result

def Xbonacci(signature,n):
    length=len(signature)
    for i in range(n-len(signature)):
        signature.append(sum(signature[-length:]))
    return signature[:n]

def Xbonacci(signature,n):
    sig = len(signature)
    if sig > n:
        return signature[:n]
    xbon = signature 
    for i in range(sig, n):
        xbon.append(sum(xbon[i-sig:]))
    return xbon

def Xbonacci(signature, n):
    length = len(signature)
    [signature.append(sum(signature[-length:])) for i in range(length, n)]
    return signature[:n]

def Xbonacci(s,n):
    if n<len(s):
        return s[:n]
    x=len(s)
    for i in range(n-len(s)):
        s.append(sum(s[-x:]))
    return s

def Xbonacci(sequence, n):
    i = 0
    while len(sequence) < n:
        sequence.append(sum(sequence[i:]))
        i+=1
    return sequence[:n]

def Xbonacci(signature,n):
    x = len(signature)
    res = signature[:n]
    
    for i in range(n - x):
        res.append(sum(res[-x:]))
        
    return res

def Xbonacci(signature,n):
    l = len(signature)
    t = signature
    i=l
    while i<n:
        t.append(sum(t[i-l:i]))
        i+=1
    return t[:n]

def Xbonacci(signature,n):
    x = len(signature)
    for _ in range(n-x):
        signature.append( sum(signature[-x:]) )
    return signature[:n]

def Xbonacci(signature,n):
    def gen_bonacci(signature):
        yield from signature
        from collections import deque
        signature = deque(signature)
        while 1:
            signature.append(sum(signature))
            signature.popleft()
            yield signature[-1]
    from itertools import islice
    return [i for i in islice(gen_bonacci(signature), n)]



def Xbonacci(signature,n):
    l = len(signature)
    for i in range(n-l):
        signature.append(sum(signature[-l:]))
    return signature if n > l else signature[:n]

def Xbonacci(signature,n):
    seq = signature[:n]
    for i in range(n - len(signature)):
        seq.append(sum(seq[-len(signature):]))
    return seq
    #your code here


def Xbonacci(signature,n):
    size = len(signature)
    while len(signature) < n:
        signature.append(sum(signature[-size:]))
    return signature[:n]

def Xbonacci(signature,n):
    sequence = signature[:]
    for i in range(len(signature), n):
        sequence.append(sum(sequence[i-len(signature):i]))
    return sequence[:n]

def Xbonacci(signature,n):    
    x = len(signature)    
    for i in range(n-x):
        signature.append(sum(signature[-x:]))
    arr = signature[:n]
    return arr