Skip to main content
Commonmark migration
Source Link

#Python, 114 110 96 90 bytes

Python, 114 110 96 90 bytes

Totally changed:

lambda n:[bin(sum(2**p for p in[range(n),{0,n-1,r,n-1-r}][0<r<n-1]))[2:]for r in range(n)]

Returns a list of strings, characters using 1 and 0.
-6 bytes thanks to TheBikingViking

Test it at ideone


Previous Python 2 @110

def f(n):g=range(n);n-=1;print'\n'.join(''.join((c in(r,n-r,0,n)or r in(0,n))and'#'or' 'for c in g)for r in g)

Test it on ideone

#Python, 114 110 96 90 bytes

Totally changed:

lambda n:[bin(sum(2**p for p in[range(n),{0,n-1,r,n-1-r}][0<r<n-1]))[2:]for r in range(n)]

Returns a list of strings, characters using 1 and 0.
-6 bytes thanks to TheBikingViking

Test it at ideone


Previous Python 2 @110

def f(n):g=range(n);n-=1;print'\n'.join(''.join((c in(r,n-r,0,n)or r in(0,n))and'#'or' 'for c in g)for r in g)

Test it on ideone

Python, 114 110 96 90 bytes

Totally changed:

lambda n:[bin(sum(2**p for p in[range(n),{0,n-1,r,n-1-r}][0<r<n-1]))[2:]for r in range(n)]

Returns a list of strings, characters using 1 and 0.
-6 bytes thanks to TheBikingViking

Test it at ideone


Previous Python 2 @110

def f(n):g=range(n);n-=1;print'\n'.join(''.join((c in(r,n-r,0,n)or r in(0,n))and'#'or' 'for c in g)for r in g)

Test it on ideone

added 35 characters in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

#Python, 114 110 96 9690 bytes

Totally changed:

deflambda b(n):m=n-1;g=range(n);return[bin[bin(sum(2**p for p in 0<r<m andin[range(n),{0,mn-1,r,mn-1-r}or g][0<r<n-1]))[2:]for r in g]range(n)]

Returns a list of strings, characters using 1 and 0.
-6 bytes thanks to TheBikingViking

Test it at ideone


Previous Python 2 @110

def f(n):g=range(n);n-=1;print'\n'.join(''.join((c in(r,n-r,0,n)or r in(0,n))and'#'or' 'for c in g)for r in g)

Test it on ideone

#Python, 114 110 96 bytes

Totally changed:

def b(n):m=n-1;g=range(n);return[bin(sum(2**p for p in 0<r<m and{0,m,r,m-r}or g))[2:]for r in g]

Returns a list of strings, characters using 1 and 0.

Test it at ideone


Previous Python 2 @110

def f(n):g=range(n);n-=1;print'\n'.join(''.join((c in(r,n-r,0,n)or r in(0,n))and'#'or' 'for c in g)for r in g)

Test it on ideone

#Python, 114 110 96 90 bytes

Totally changed:

lambda n:[bin(sum(2**p for p in[range(n),{0,n-1,r,n-1-r}][0<r<n-1]))[2:]for r in range(n)]

Returns a list of strings, characters using 1 and 0.
-6 bytes thanks to TheBikingViking

Test it at ideone


Previous Python 2 @110

def f(n):g=range(n);n-=1;print'\n'.join(''.join((c in(r,n-r,0,n)or r in(0,n))and'#'or' 'for c in g)for r in g)

Test it on ideone

added 279 characters in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

#Python 2, 114 110 11096 bytes

Totally changed:

def b(n):m=n-1;g=range(n);return[bin(sum(2**p for p in 0<r<m and{0,m,r,m-r}or g))[2:]for r in g]

Returns a list of strings, characters using 1 and 0.

Test it at ideone


Previous Python 2 @110

def f(n):g=range(n);n-=1;print'\n'.join(''.join((c in(r,n-r,0,n)or r in(0,n))and'#'or' 'for c in g)for r in g)

Test it on ideone

#Python 2, 114 110 bytes

def f(n):g=range(n);n-=1;print'\n'.join(''.join((c in(r,n-r,0,n)or r in(0,n))and'#'or' 'for c in g)for r in g)

Test it on ideone

#Python, 114 110 96 bytes

Totally changed:

def b(n):m=n-1;g=range(n);return[bin(sum(2**p for p in 0<r<m and{0,m,r,m-r}or g))[2:]for r in g]

Returns a list of strings, characters using 1 and 0.

Test it at ideone


Previous Python 2 @110

def f(n):g=range(n);n-=1;print'\n'.join(''.join((c in(r,n-r,0,n)or r in(0,n))and'#'or' 'for c in g)for r in g)

Test it on ideone

Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282
Loading