LearnPy Hub
← Operators problems
Hard

Gray Code

Read k (1–6). For each n from 0 to 2ᵏ − 1, print n's Gray code n ^ (n >> 1) in binary, padded with zeros to k digits.

Input

One integer.

Output

2ᵏ lines.

Sample 1

Input
2
Output
00
01
11
10

Sample 2

Input
1
Output
0
1
solution.py
Output appears here
Gray Code · Python practice problem · LearnPy Hub