Skip to main content
added 133 characters in body
Source Link
ovs
  • 61.2k
  • 3
  • 49
  • 164

Python 2, 138138 136 bytes

-2 bytes thanks to Erik the Outgolfer.

r=[];d=0
for n in input()+[0]:
 a=n-([n]+r)[-1]
 if(a-d)*d:
	if r[2:]:r=["%dto%d"%(r[0],r[r=["%dto"%r[0]+`r[-1])+"by%s"%d*1]`+"by%s"%d*(1%d)]
	print r.pop(0),
 r+=n,;d=a

Try it online!Try it online!

Python 2, 138 bytes

r=[];d=0
for n in input()+[0]:
 a=n-([n]+r)[-1]
 if(a-d)*d:
	if r[2:]:r=["%dto%d"%(r[0],r[-1])+"by%s"%d*(1%d)]
	print r.pop(0),
 r+=n,;d=a

Try it online!

Python 2, 138 136 bytes

-2 bytes thanks to Erik the Outgolfer.

r=[];d=0
for n in input()+[0]:
 a=n-([n]+r)[-1]
 if(a-d)*d:
	if r[2:]:r=["%dto"%r[0]+`r[-1]`+"by%s"%d*(1%d)]
	print r.pop(0),
 r+=n,;d=a

Try it online!

Source Link
ovs
  • 61.2k
  • 3
  • 49
  • 164

Python 2, 138 bytes

r=[];d=0
for n in input()+[0]:
 a=n-([n]+r)[-1]
 if(a-d)*d:
	if r[2:]:r=["%dto%d"%(r[0],r[-1])+"by%s"%d*(1%d)]
	print r.pop(0),
 r+=n,;d=a

Try it online!