#3 Pyramid No Pattern in Python (Value same as row no)

 

Pyramid No Pattern in Python 

Explanation:-
The value to be printed is same as the row no 
So the value to printed would be i as i represents row and start the value from j from -1


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 0 to n

Step 5:- Stop 



Code:-
#value same as row_no
n=int(input())
for i in range(n):
    for j in range(-1,i):
        print(i,end=" ")
    print()


Run The Code





Post a Comment

0 Comments