Skip to main content
added 41 characters in body
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287

Python 3.5, 74 7272 71 bytes

f=lambda L,*S:print(*S,*L)@ff([sum(x)%10for x in zip(L,L[1:print(*S,*L)]or 1)],'',*S)

Input is a list of integers (e.g. f([1,2,3,5,8])), output is to STDOUT. The %10 and the fact that map returns a map object in Python 3 is a bit annoying, meaning we can't do map(lambda*x:sum(x)%10,L,L[1:]) or similar.

The function errors out, but by then the output would have completed. Thanks to @xsot for -1 byte by finding a good place to stick the @print is just an irrelevant binary op here.

Python 3.5, 74 72 bytes

f=lambda L,*S:print(*S,*L)@f([sum(x)%10for x in zip(L,L[1:]or 1)],'',*S)

Input is a list of integers (e.g. f([1,2,3,5,8])), output is to STDOUT. The %10 and the fact that map returns a map object in Python 3 is a bit annoying, meaning we can't do map(lambda*x:sum(x)%10,L,L[1:]) or similar.

The function errors out, but by then the output would have completed. @ is just an irrelevant binary op here.

Python 3.5, 74 72 71 bytes

f=lambda L,*S:f([sum(x)%10for x in zip(L,L[1:print(*S,*L)]or 1)],'',*S)

Input is a list of integers (e.g. f([1,2,3,5,8])), output is to STDOUT. The %10 and the fact that map returns a map object in Python 3 is a bit annoying, meaning we can't do map(lambda*x:sum(x)%10,L,L[1:]) or similar.

The function errors out, but by then the output would have completed. Thanks to @xsot for -1 byte by finding a good place to stick the print.

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

Python 3.5, 74 72 bytes

f=lambda L,*S:print(*S,*L)@f([sum(x)%10for x in zip(L,L[1:]or 1)],'',*S)

Input is a list of integers (e.g. f([1,2,3,5,8])), output is to STDOUT. The %10 and the fact that map returns a map object in Python 3 is a bit annoying, meaning we can't do map(lambda*x:sum(x)%10,L,L[1:]) or similar.

The function errors out, but by then the output would have completed. @ is just an irrelevant binary op here.

Python 3.5, 74 72 bytes

f=lambda L,*S:print(*S,*L)@f([sum(x)%10for x in zip(L,L[1:]or 1)],'',*S)

Input is a list of integers (e.g. f([1,2,3,5,8])), output is to STDOUT. The %10 and the fact that map returns a map object in Python 3 is a bit annoying, meaning we can't do map(sum,L,L[1:]) or similar.

The function errors out, but by then the output would have completed. @ is just an irrelevant binary op here.

Python 3.5, 74 72 bytes

f=lambda L,*S:print(*S,*L)@f([sum(x)%10for x in zip(L,L[1:]or 1)],'',*S)

Input is a list of integers (e.g. f([1,2,3,5,8])), output is to STDOUT. The %10 and the fact that map returns a map object in Python 3 is a bit annoying, meaning we can't do map(lambda*x:sum(x)%10,L,L[1:]) or similar.

The function errors out, but by then the output would have completed. @ is just an irrelevant binary op here.

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

Python 3.5, 7474 72 bytes

f=lambda L,*S:L and print(*S,*L)@f([sum(x)%10for x in zip(L,L[1:]]or 1)],'',*S)

Input is a list of integers (e.g. f([1,2,3,5,8])), output is to STDOUT. The %10 and the fact that map returns a map object in Python 3 is a bit annoying, meaning we can't do map(sum,L,L[1:]) or similar.

The function errors out, but by then the output would have completed. @ is just an irrelevant binary op here.

Python 3.5, 74 bytes

f=lambda L,*S:L and print(*S,*L)@f([sum(x)%10for x in zip(L,L[1:])],'',*S)

Input is a list of integers (e.g. f([1,2,3,5,8])), output is to STDOUT. The %10 and the fact that map returns a map object in Python 3 is a bit annoying, meaning we can't do map(sum,L,L[1:]) or similar.

The function errors out, but by then the output would have completed.

Python 3.5, 74 72 bytes

f=lambda L,*S:print(*S,*L)@f([sum(x)%10for x in zip(L,L[1:]or 1)],'',*S)

Input is a list of integers (e.g. f([1,2,3,5,8])), output is to STDOUT. The %10 and the fact that map returns a map object in Python 3 is a bit annoying, meaning we can't do map(sum,L,L[1:]) or similar.

The function errors out, but by then the output would have completed. @ is just an irrelevant binary op here.

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