Python example to print Exponentially Increasing Star Pattern

import math
# Take the Input From the User
rows = int(input("Enter the total Number of Rows: "))
# Print the Output
print("Exponentially Increasing Stars Pattern")
i = 0
while(i <= rows):
    j = 1
    while(j <= math.pow(2, i)):
        print('*', end = '  ')
        j = j + 1
    i = i + 1
    print()

OUTPUT:

Enter the total Number of Rows: 4
Exponentially Increasing Stars Pattern
*
*  *
*  *  *  *
*  *  *  *  *  *  *  *
*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  

Leave a Comment