Skip to main content
Golf further
Source Link
justhalf
  • 2.2k
  • 1
  • 19
  • 32

Python 3, 8888 84 bytes

l=2;s=''
for c in''.join(bin(128+ordf'{ord(c))[3:]for07b}'for c in input()):s+='01'[l!=c];l=c
print(s)

Try it online!

I feel that the assignments should be avoidable, but couldn't think of any way to do that.

Update:

Python 3, 88 bytes

l=2;s=''
for c in''.join(bin(128+ord(c))[3:]for c in input()):s+='01'[l!=c];l=c
print(s)

Try it online!

I feel that the assignments should be avoidable, but couldn't think of any way to do that.

Python 3, 88 84 bytes

l=2;s=''
for c in''.join(f'{ord(c):07b}'for c in input()):s+='01'[l!=c];l=c
print(s)

Try it online!

I feel that the assignments should be avoidable, but couldn't think of any way to do that.

Update:

Source Link
justhalf
  • 2.2k
  • 1
  • 19
  • 32

Python 3, 88 bytes

l=2;s=''
for c in''.join(bin(128+ord(c))[3:]for c in input()):s+='01'[l!=c];l=c
print(s)

Try it online!

I feel that the assignments should be avoidable, but couldn't think of any way to do that.