More List Exercises

Many, if not all, the exercises below will use the "dictall.txt" list of English words, so download it into a directory that will contain your Python programs.

1. Find the longest palindrome in the word list, or a list of the longest palindromes, in case there's more than one.  Put that answer into the Comments-to-Teacher.  This answer must be completely computed by your Python functions -- you may NOT look at a list and pick out answer(s) by eye.

2. Create the function IsAnagram(w1,w2) that will be given two words and will return True if they're anagrams of each other.

3. Create the function AnagramsOf(w) which will return a list of all the anagrams of the word w from the word list.  Using it, find all the anagrams of the word "scrape".  Put them into the Comments-to-Teacher.

4. Create the function Uniqueify(L)  that will be given either a list of numbers or a list of strings (non-empty), and will return a list of the unique elements of that list.  In other words, it will eliminate duplicates.  The output list does not have to be in the same order as the input list.

5. Create the function OneLetterAway(wordlist,root) which will be given a filename of a list of words and also a word (which we'll call the "root"), and will return a list of words that are "one letter away" from the root.  For instance, if the root is the word "store", then the words "story" and "stove" are one letter away.  In other words, you can change only a single letter from the root.  Put into the Comments-to-Teacher the result of running OneLetterAway('dictall.txt','beast').  As an example of its output:

OneLetterAway('dictall.txt','store') will return:
['store', 'score', 'shore', 'snore', 'spore', 'swore', 'stare', 'stoke', 'stole', 'stone', 'stove', 'stork', 'storm', 'story']