Created
January 20, 2024 12:06
-
-
Save eitozx/8c2ae3813b0bc0214651ffeccdedfe26 to your computer and use it in GitHub Desktop.
Christmas Tree (idk really lol)
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 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