Gray code by hallvabo

M=input('Gray code  n=')
print M
for n in range(1<<M):print`[(n/2^n)>>M+~i&1for i in range(M)]`[1::3]

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top