Full Pyramid Pattern using Stars - Learn Engineering

All the news and updates relevant to Engineering. You can also Write a post here

Breaking

Friday, June 19, 2020

Full Pyramid Pattern using Stars

python-mini

Question

To Print Full Pyramid pattern using stars.

Sample TestCaseExpected Output

Enter number of rows : 3                                                                                    *

                                                                                                                                            *       *
                                                                                                                                        *       *        *





Answer


n=int(input("Enter  nummber of rows : "))
for i in range(1,n+1):
    k=0
    for j in range(1,n-i+1):
        print(" ",end=" ")
        while(k!=2*i-1):
            print("*",end=" ")
            k+=1
        print("\n")     



No comments:

Post a Comment