Kevin is noticing his space run out! Write a function that removes the spaces from the values and returns an array showing the space decreasing.
For example, running this function on the array ['i', 'have','no','space'] would produce ['i','ihave','ihaveno','ihavenospace'].

Difficulty: introductory

Starter code:

def spacey(array):
	

Solutions:
from itertools import accumulate

def spacey(a):
    return list(accumulate(a))

def spacey(array):
    return [''.join(array[:i+1]) for i in range(len(array))]

def spacey(array):
    strr = ''
    out = []
    for el in array:
        strr += str(el)
        out.append(strr)
    return out

def spacey(array):
    return ["".join(array[:i]) for i, _ in enumerate(array, 1)]

from itertools import accumulate
def spacey(array):
    return list(accumulate(array))

def spacey(array):
    new_s = []
    s = ""
    for i in array:
        s+=i
        new_s.append(s)
    return new_s

from functools import reduce

def spacey(array):
    return reduce(lambda a, b: a + [a[-1] + b] if a else [b], array, [])

def spacey(array):
    
    if len(array) != 0:
        string = [array[0]]
        for index in range(2,len(array)+1):
            for i in range(index-1,index):
                string = string + [string[i-1]+array[i]]
        return string
    else:
        return array

spacey=lambda a:list(__import__('itertools').accumulate(a))

from itertools import accumulate


def spacey(array):
    return list(map("".join, accumulate(array)))