hw17: Friend words
- Due before the beginning of class on Friday, March 20
The Data
Run git pull in your sd212 directory.
You should see a new folder for this homework with two files:
10k-words.txtis a list of 10,000 common English words (source)friends.pyis a working Python program that you will modify.
Starter code
The friends.py program looks through that list of words and prints out all pairs
of words that are “friends”, meaning that the two words are exactly the
same except for their 2nd and 6th letters. For example,
“mAssiVe” and
“mIssiLe” are friends.
Your task
If you run friends.py as-is, it works correctly to find all friend
words, but takes a little while, probably about 30 seconds.
Improve the code so that it uses Python multiprocessing and 5 concurrent calls to check_words so that it gets all the same results (maybe in a different order), but runs faster.
Submit command
To submit files for this homework, run one of these commands:
submit -c=sd212 -p=hw17 friends.py
club -csd212 -phw17 friends.py