Last active
January 2, 2016 01:29
-
-
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:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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