Create a function xMasTree(height) that returns a christmas tree of the correct height. The height is passed through to the function and the function should return a list containing each line of the tree. 
```
xMasTree(5) should return : ['____#____', '___###___', '__#####__', '_#######_', '#########', '____#____', '____#____']
xMasTree(3) should return : ['__#__', '_###_', '#####', '__#__', '__#__']
```
The final idea is for the tree to look like this if you decide to print each element of the list: 
``` 
xMasTree(5) will result in:
____#____              1
___###___              2
__#####__              3
_#######_              4
#########       -----> 5 - Height of Tree
____#____        1      
____#____        2 - Trunk/Stem of Tree

xMasTree(3) will result in:
__#__                  1
_###_                  2
#####          ----->  3 - Height of Tree
__#__           1
__#__           2 - Trunk/Stem of Tree
```
Pad with underscores i.e _ so each line is the same length. The last line forming the tree having only hashtags, no spaces. Also remember the trunk/stem of the tree.

Difficulty: introductory

Starter code:

def xMasTree(n):
	

Solutions:
def xMasTree(n):
   return [("#"*(x*2+1)).center(n*2-1, "_") for x in list(range(n))+[0]*2]

def xMasTree(n):
    hashtags = '#' * (n - 1)
    spaces = '_' * (n - 1)
    tree = []
    for i in range(n):
        left = spaces[i:] + hashtags[:i]
        tree.append(left + '#' + left[::-1])
    for i in range(2):
        tree.append(spaces + '#' + spaces)
    return tree

def xMasTree(n):
    w = 2*n-1
    return [ ('#'*(i<n and 2*i+1 or 1)).center(w,'_') for i in range(n+2)]

def xMasTree(n):
    w = list(range(1, n * 2, 2)) + [1, 1]
    return [f"{'#' * i}".center(n * 2 - 1, "_") for i in w]


def xMasTree(n):
    r = ['_' * (n - x//2 - 1) + '#' * x + '_' * (n - x//2 - 1) for x in range(1, n * 2, 2)]
    return r + r[:1] * 2

def xMasTree(n):
    n2 = n * 2 - 1
    return [('#' * i).center(n2, '_') for i in range(1, n2 + 1, 2)] + ['#'.center(n2, '_')] * 2

def xMasTree(n):
    width = 2 * n - 1
    return [
        ('#' * (m if m <= width else 1)).center(width, '_')
        for m in range(1, width + 5, 2)]

def xMasTree(n):
    width = 2*n - 1
    row = 1
    res = []
    while row <= n:
        line = ''
        buff = '_'*(n-row)
        line += buff
        line += '#'*(2*row-1)
        line += buff
        res.append(line)
        row += 1
    for x in range(2):
        line = ''
        buff = '_'*(n-1)
        line += buff
        line += '#'
        line += buff
        res.append(line)
    return res

xMasTree=lambda n: (lambda part: part+[part[0],part[0]])(["".join(["_"*(n-i-1),"#"*(2*i+1),"_"*(n-i-1)]) for i in range(n)])