Homework help requested, thanks to everyone.
Skip Montanaro
skip at pobox.com
Mon Jul 22 13:01:49 EDT 2013
John> Another project I thought of was a Pig Latin translator. (But
do kids today
John> even know what Pig Latin is? Am I showing my age?)
Chris> Even if they don't, they'll grok it no problem. It's simple enough.
Google for "Python pig latin" to see a lot of "prior art".
And it might be useful as a step as part of a word-based password generator. :-)
>>> words = open("/usr/dict/words")
>>> words = [word.strip() for word in words if len(word) == 5]
>>> len(words)
2194
>>> import random
>>> random.shuffle(words)
>>> words[0:4]
['live', 'skat', 'levy', 'cove']
>>> [makePigLatin(word) for word in words[0:4]]
['ivelay', 'atskay', 'evylay', 'ovecay']
:-)
Skip
More information about the Python-list
mailing list