Skip to content

Instantly share code, notes, and snippets.

@gorlum0
Created September 7, 2012 15:49
Show Gist options
  • Save gorlum0/3667332 to your computer and use it in GitHub Desktop.
Save gorlum0/3667332 to your computer and use it in GitHub Desktop.
Some convenience funcs for algs4partI-class exercises - easier in numbers for me than in alphabet.
#algs4partI-class
def str2nums(s):
return [ord(x)-ord('A') for x in s.split()]
def nums2str(l):
return ' '.join(chr(x + ord('A')) for x in l)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment