Here your task is to Create a (nice) Christmas Tree.
You don't have to check errors or incorrect input values, every thing is ok without bad tricks, only one int parameter as input and a string to return;-)...
So what to do?First three easy examples:

````
Input: 3 and Output:
  *
 ***
*****
 ###
 
 Input 9 and Output:
    *
   ***
  *****
   ***
  *****
 *******
  *****
 *******
*********
   ###
   
 Input 17 and Output:
      *
     ***
    *****
     ***
    *****
   *******
    *****
   *******
  *********
   *******
  *********
 ***********
  *********
 ***********
*************
     ###
     
Really nice trees, or what???! So merry Christmas;-)
````

You can see, always a root, always steps of hight 3, tree never smaller than 3 (return "") and no difference for input values like 15 or 17 (because (int) 15/3 = (int) 17/3). That's valid for every input and every tree.
I think there's nothing more to say - perhaps look at the testcases too;-)!

There are some static tests at the beginning and many random tests if you submit your solution. 
Hope you have fun:-)!

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Starter code: def christmas_tree(height):
	

Solutions:
def christmas_tree(h):
	return '' if h < 3 else '\r\n'.join(['\r\n'.join([' ' * ((5 - y) // 2 + h // 3 - i - 1) + '*' * (y + i * 2) for y in [1, 3, 5]]) for i in range(h // 3)]) + '\r\n' + ' ' * (h // 3) + '###'


def christmas_tree(height):
	(height, tree) = (height // 3, [])
	for floor in range(height):
		for branch in range(floor, 3 + floor):
			tree.append(f"{' ' * (height - branch + 1)}{'*' * (branch * 2 + 1)}")
	tree.append(f"{' ' * height}###")
	return '\r\n'.join(tree) if height else ''


def christmas_tree(height):
	height = height // 3 * 3
	if height <= 0:
		return ''
	lines = []
	w = 3
	for i in range(height):
		w += 2 if i % 3 else -2
		lines.append('*' * w)
	lines.append('###')
	return '\r\n'.join((line.center(w).rstrip() for line in lines))


def christmas_tree(height):
	if height < 3:
		return ''
	result = []
	for i in range(height // 3):
		w = 1 + 2 * i
		result.append('*' * w)
		result.append('*' * (w + 2))
		result.append('*' * (w + 4))
	result.append('###')
	l = len(result[-2])
	return '\r\n'.join([line.center(l).rstrip() for line in result])


christmas_tree = lambda n: '\r\n'.join([(n // 3 - j + 1) * ' ' + (2 * j + 1) * '*' for i in range(n // 3) for j in range(i, i + 3)] + [n // 3 * ' ' + 3 * '#'] * (n // 3 > 0))


christmas_tree = lambda n: '\r\n'.join([('*' * (j - p)).center(n // 3 * 2 + 3, ' ').rstrip() for (o, i) in enumerate(range(1, n // 3 * 3, 3)) for (p, j) in enumerate(range(i - o, i - o + 9, 3))] + ['###'.center(n // 3 * 2 + 3).rstrip()] if n > 2 else '')


def christmas_tree(height):
	h = height - height % 3
	(n, r) = (h // 3, '')
	(sz, l1, l2, l3, k) = (5 + (n - 1) * 2, '*', '***', '*****', '\r\n')
	w = (sz - len(l1)) // 2
	for i in range(n):
		r += ' ' * w + l1 + k
		r += ' ' * (w - 1) + l2 + k
		r += ' ' * (w - 2) + l3 + k
		w -= 1
		l1 += '**'
		l2 += '**'
		l3 += '**'
	return r + ' ' * ((sz - 3) // 2) + '###' if height > 2 else ''


def christmas_tree(height):
	s = '* *** *****'.split()
	r = []
	for i in range(height // 3):
		for x in s:
			r.append(' ' * ((2 * (height // 3) + 3 - 2 * i - len(x)) // 2) + '*' * 2 * i + x)
	return '\r\n'.join(r + [' ' * (height // 3) + '###']) if height // 3 else ''


def christmas_tree(height):
	if height < 3:
		return ''
	res = [1, 3, 5]
	for _ in range((height - 3) // 3):
		res.extend(res[-2:] + [res[-1] + 2])
	w = max(res)
	ans = [('*' * r).center(w).rstrip() for r in res] + ['###'.center(w).rstrip()]
	return '\r\n'.join(ans)


def christmas_tree(h):
	if h < 3:
		return ''
	(h, r) = (h // 3, [])
	m = h * 2 + 3
	r = ['*' * (2 * (i + j) + 1) for i in range(h) for j in range(3)] + ['#' * 3]
	return '\r\n'.join(map(lambda x: x.center(m).rstrip(), r))