Z 438 NUMBER PATTERN-5 Python Hackerrank

 PRINT THE BELOW MENTIONED PATTERN FOR ANY "N" VALUE. WHERE "N" INDICATES NO.OF ROWS.

Input Format

A SINGLE INTEGER DENOTING N VALUE

Constraints

1<=N<=100

Output Format

PATTERN AS SHOWN IN SAMPLE TEST CASE

Sample Input 0

5

Sample Output 0

1
 2
  3
   4
    5
Source Code:
# Enter your code here. Read input from STDIN. Print output to STDOUT
n=int(input())
for i in range(1, n + 1):
    for j in range(1, n + 1):
        if j==i:
            print(j, end="")
        else:
            print(" ",end="")
    print()
        

Comments