0
433views
Write a Python Program to Create No Pyramid Pattern (Value same as row no+1)
1 Answer
written 2.6 years ago by |
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+1 no of times for n rows (for no of rows)
Step 3:- Take 2nd for loop to iterate i items in a row (increment j corresponding to i)
Step 4:- Increment the value of i from 1 to n
Step 5:- Stop
Code:-
n=int(input("No of Rows in the pattern: "))
for i in range(1,n+1):
for j in range(1,i+1):
print(i,end=" ")
print()
Output