Skip to content

Instantly share code, notes, and snippets.

@mdwhatcott
Last active January 2, 2016 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdwhatcott/8230292 to your computer and use it in GitHub Desktop.
Save mdwhatcott/8230292 to your computer and use it in GitHub Desktop.
Here's some Python code to convert a passage of text into first-letter sequences to facilitate memorization:
def first_letter_mnemonic(text):
words = text.split()
letters = []
for word in words:
letters.append(word[0])
if word[-1] in ',-': # inline punctuation
letters.append(word[-1])
elif word[-1] in '.;:?!': # delimiting punctuation
letters.append(word[-1] + ' ')
return (''.join(letters)).strip()
print first_letter_mnemonic('<paste_verse_here>')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment