Script
#!/usr/local/bin/python3.7
print()
height = int(input("Enter the height of the tree: "))
print()
for row in range(height):
for count in range(2 * height - row):
print(end = ' ')
for count in range(2 * row + 1):
print(end = '*')
print()
print()
Execution
Enter the height of the tree: 12
*
***
*****
*******
*********
***********
*************
***************
*****************
*******************
*********************
***********************
Enter the height of the tree: 30
*
***
*****
*******
*********
***********
*************
***************
*****************
*******************
*********************
***********************
*************************
***************************
*****************************
*******************************
*********************************
***********************************
*************************************
***************************************
*****************************************
*******************************************
*********************************************
***********************************************
*************************************************
***************************************************
*****************************************************
*******************************************************
*********************************************************
***********************************************************
#!/usr/local/bin/python3.7
print()
height = int(input("Enter the height of the tree: "))
print()
for row in range(height):
for count in range(2 * height - row):
print(end = ' ')
for count in range(2 * row + 1):
print(end = '*')
print()
print()
Execution
Enter the height of the tree: 12
*
***
*****
*******
*********
***********
*************
***************
*****************
*******************
*********************
***********************
Enter the height of the tree: 30
*
***
*****
*******
*********
***********
*************
***************
*****************
*******************
*********************
***********************
*************************
***************************
*****************************
*******************************
*********************************
***********************************
*************************************
***************************************
*****************************************
*******************************************
*********************************************
***********************************************
*************************************************
***************************************************
*****************************************************
*******************************************************
*********************************************************
***********************************************************
No comments:
Post a Comment