Last active
April 16, 2025 11:51
-
-
Save adityasuseno/ae484656b823e547fbc19a3562361c44 to your computer and use it in GitHub Desktop.
Simple Python Script to Draw a Tree
This file contains hidden or 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
| #!/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