Skip to content

Instantly share code, notes, and snippets.

@keNzi
Last active May 12, 2018 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keNzi/77abc30a6523c63e72795cdf6f163295 to your computer and use it in GitHub Desktop.
Save keNzi/77abc30a6523c63e72795cdf6f163295 to your computer and use it in GitHub Desktop.
def xmassTree(floors):
for x in [z for z in range(1, floors * 2 + 1, 2)]:
floors -= 1
print(' ' * floors, '*' * x)
xmassTree(5)
def xmasttree(count):
needle_count = [x for x in range(1, count * 2 + 1, 2)]
while count >= 1:
for needle in needle_count:
print(' ' * count + '*' * needle)
count -= 1
xmasttree(20)
def xmasttree(count):
needle_count = [x for x in range(1, count * 2 + 1, 2)]
for needle in needle_count:
print(' ' * count + '*' * needle)
count -= 1
if count == 0: break
xmasttree(20)
def xmassTree(floors):
igles = [x for x in range(1, floors * 2 + 1, 2)]
for x in igles:
print(' ' * floors, '*' * x)
floors -= 1
xmassTree(5)
def xmassTree(floors):
empty_space = [x for x in range(floors, 0, -1)]
igles = [x for x in range(1, floors * 2 + 1, 2)]
for y, z in zip(empty_space, igles):
print(' ' * y, '*' * z)
xmassTree(10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment