0
372views
Write a Python Program to Create Pyramid No Pattern (Value same as row no)
1 Answer
written 2.4 years ago by |
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('No of Rows in the pattern: '))
for i in range(n):
for j in range(-1,i):
print(i,end=" ")
print()
Output:-