#4 Pyramid No Pattern in Python (Value same as row no +1)

Pyramid No Pattern in Python 

Explanation:-
The value to be printed is same as the row no +1
So the value to printed would be i +1 as i +1 represents row as row starts from 0 
 

Step 1:- Take input for no of row

Step 2:- Start 1st for loop to iterate n no of times (n rows)

Step 3:- Take 2nd for loop to iterate i items in a row

Step 4:- Increment the value of i from 1 to n

Step 5:- Stop 

Code:- 

n=int(input())

for i in range(1,n):

    for j in range(1,i+1):

        print(i,end=" ")

    print()






Run The Code




Post a Comment

0 Comments