Z 436 NUMBER PATTERN-2 Python Hacker Rank

 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
01
101
0101
10101

Sample Input 1

3

Sample Output 1

1
01
 




101
Source Code
n = int(input())
for i in range(1, n + 1):
    for j in range(1, i +1):
        print((i + j + 1) % 2,end ="")
    print()

Comments