Wednesday, July 31, 2019

Star tree - Method 3

Script

#!/usr/local/bin/python3.7

print()
height = int(input("Please enter the height of the tree: "))

for row in range(height):
    for count in range(height - row):
        print(end = ' ')
    for count in range(2 * row - 1):
        print(end = '*')
    print()
print()


Execution


Please enter the height of the tree: 15

              *
             ***
            *****
           *******
          *********
         ***********
        *************
       ***************
      *****************
     *******************
    *********************
   ***********************
  *************************
 ***************************





No comments:

Post a Comment