Skip to content

Instantly share code, notes, and snippets.

@inky
Created September 24, 2014 23:44
Show Gist options
  • Save inky/fe56fdd2b7969b1e65b3 to your computer and use it in GitHub Desktop.
Save inky/fe56fdd2b7969b1e65b3 to your computer and use it in GitHub Desktop.

Revisions

  1. Liam Cooke created this gist Sep 24, 2014.
    7 changes: 7 additions & 0 deletions ellobinary.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    def str_to_binary(a_string):
    return ' '.join(format(ord(c), 'b').zfill(8) for c in a_string)

    def ello_string(a_string):
    return str_to_binary(a_string).replace('0', 'O').replace('1', 'L')

    print ello_string('ello orld')