Skip to content

Instantly share code, notes, and snippets.

@adityasuseno
Last active April 16, 2025 11:51
Show Gist options
  • Select an option

  • Save adityasuseno/ae484656b823e547fbc19a3562361c44 to your computer and use it in GitHub Desktop.

Select an option

Save adityasuseno/ae484656b823e547fbc19a3562361c44 to your computer and use it in GitHub Desktop.
Simple Python Script to Draw a Tree
#!/usr/bin/env python3
while True:
try:
rows = int(input("Enter number of rows: "))
break
except ValueError:
print("Please enter integer only! Try again...")
for i in range(rows):
for j in range(rows - i - 1):
print(end=" ")
for j in range(2 * i + 1):
print("*", end="")
print()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment