πŸ’‘ Manmohan Loves Patterns- II

MANMOHAN LOVES PATTERNS- II
Help Manmohan to print pattern of a given number. See the output pattern for given input n = 5.

Input Format:
Single integer N denoting number of lines of the pattern.

Constraints:
N<=1000

Output Format
Pattern.

Sample Input
5
Sample Output
1
11
202
3003
40004
what is the logic in this pattern?

@Sheenagoyal21 Considering the sample input:
Sample Input
5
Sample Output
1
11
202
3003
40004

You can obeserve that 0th row will have 1. After that from the 1st row, the first and the last element of wach row will be the row number. There will be zeros in between.

please can you tell me the code…

n = int(input())

print(1)

i=1

while i<=n-1:

j=1

while j<=i+1:

    if(j==1 or j>=i+1):

        print(i,end='')

    else:

        print('0',end='')

    j=j+1

    

print()

i=i+1