Last active
May 12, 2018 21:47
-
-
Save keNzi/77abc30a6523c63e72795cdf6f163295 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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