Skip to content

Instantly share code, notes, and snippets.

@eitozx
Created January 20, 2024 12:06
Show Gist options
  • Save eitozx/8c2ae3813b0bc0214651ffeccdedfe26 to your computer and use it in GitHub Desktop.
Save eitozx/8c2ae3813b0bc0214651ffeccdedfe26 to your computer and use it in GitHub Desktop.
Christmas Tree (idk really lol)
def branch(num : int, f : int):
return f'{" " * f}{"*" * num}*{"*" * num}'
def christmas(f):
e = None
for i in range(f):
print(branch(i,f-i))
if e is None:
e = branch(i+1, f-i-1)
print(e, e, sep='\n')
number = int(input("Size: "))
christmas(number)
# example output:
# Size: 11
# *
# ***
# *****
# *******
# *********
# ***********
# *************
# ***************
# *****************
# *******************
# *********************
# ***
# ***
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment