This is a Python Program to read a number n and print an inverted star pattern of the desired size.

The program takes a number n and prints an inverted star pattern of the desired size.

1. Take a value from the user and store it in a variable n.

2. Use a for loop where the value of i ranges between the values of n-1 and 0 with a decrement of 1 with each iteration.

3. Multiply empty spaces with n-i and ‘*’ with i and print both of them.

4. Exit.

Here is the source code of the Python Program to read a number n and print an inverted star pattern of the desired size. The program output is also shown below.

n=int(input("Enter number of rows: ")) for i in range (n,0,-1): print((n-i) * ' ' + i * '*')

1. User must first enter the value and store it in a variable n.

2. The for loop enables i to range between n-1 and 0 with a decrement of 1 with each iteration.

3. For each iteration, ” ” is multiplied with n-i and ‘*’ is multiplied with i to ensure correct spacing of the stars.

4. The required pattern is printed.

Case 1: Enter number of rows: 5 ***** **** *** ** * Case 2: Enter number of rows: 10 ********** ********* ******** ******* ****** ***** **** *** ** *

**Sanfoundry Global Education & Learning Series – Python Programs.**

To practice all Python programs, __here is complete set of 150+ Python Problems and Solutions__.