Skip to main content
Commonmark migration
Source Link

#Python 3, 103 97 82 78 76 bytes

Python 3, 103 97 82 78 76 bytes

def P(L,n=0):k,*L=L;exec("print(*[0]*n+[1]*k+[0]*sum(L));"*k);L and P(L,n+k)

Using splat to take advantage of the space-separating nature of print, with a bit of recursion.

#Python 3, 103 97 82 78 76 bytes

def P(L,n=0):k,*L=L;exec("print(*[0]*n+[1]*k+[0]*sum(L));"*k);L and P(L,n+k)

Using splat to take advantage of the space-separating nature of print, with a bit of recursion.

Python 3, 103 97 82 78 76 bytes

def P(L,n=0):k,*L=L;exec("print(*[0]*n+[1]*k+[0]*sum(L));"*k);L and P(L,n+k)

Using splat to take advantage of the space-separating nature of print, with a bit of recursion.

added 4 characters in body
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287

#Python 3, 103 97 8282 78 76 bytes

def P(L,n=0):k=L.pop(0);execk,*L=L;exec("print(*([0]*n+[1]*k+[0]*sum*[0]*n+[1]*k+[0]*sum(L)));"*k);L and P(L,n+k)

Using splat to take advantage of the space-separating nature of print, with a bit of recursion.

#Python 3, 103 97 82 bytes

def P(L,n=0):k=L.pop(0);exec("print(*([0]*n+[1]*k+[0]*sum(L)));"*k);L and P(L,n+k)

Using splat to take advantage of the space-separating nature of print, with a bit of recursion.

#Python 3, 103 97 82 78 76 bytes

def P(L,n=0):k,*L=L;exec("print(*[0]*n+[1]*k+[0]*sum(L));"*k);L and P(L,n+k)

Using splat to take advantage of the space-separating nature of print, with a bit of recursion.

deleted 312 characters in body
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287

#Python 3, 103103 97 82 bytes

def P(L,n=0):[printk=L.pop(0);exec("print(*([0]*sum[0]*n+[1]*k+[0]*sum(L[:i]L)+[1]*L[i]+[0]*sum(L[i+1:]));"*k)for i;L inand range(lenP(L))for _ in range(L[i],n+k)]

Using splat to take advantage of the space-separating nature of print.


As a bonus, here'swith a "what on earth are you doing" solution which turned out to be the same numberbit of bytes:

def P(L):[any(map(print,*zip(*[[0]*sum(L[:i])+[1]*L[i]+[0]*sum(L[i+1:])]*L[i])))for i in range(len(L))]

This makes me think that surely I can golf out more..recursion.

#Python 3, 103 bytes

def P(L):[print(*([0]*sum(L[:i])+[1]*L[i]+[0]*sum(L[i+1:])))for i in range(len(L))for _ in range(L[i])]

Using splat to take advantage of the space-separating nature of print.


As a bonus, here's a "what on earth are you doing" solution which turned out to be the same number of bytes:

def P(L):[any(map(print,*zip(*[[0]*sum(L[:i])+[1]*L[i]+[0]*sum(L[i+1:])]*L[i])))for i in range(len(L))]

This makes me think that surely I can golf out more...

#Python 3, 103 97 82 bytes

def P(L,n=0):k=L.pop(0);exec("print(*([0]*n+[1]*k+[0]*sum(L)));"*k);L and P(L,n+k)

Using splat to take advantage of the space-separating nature of print, with a bit of recursion.

Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287
Loading