Assignment 3 Part 4 (submitted by Adam on Feb 15, 22:44)

Beautiful Code
Ka-Ping Yee

AUTHORS:   Adam   Calvin   Chris   David   Derek   Hunter   Jacob   Jason   Jun   Karl   Kevin   Michael   Morgan   Nadia   Nerissa   Omair   Peter   Peterson   Ping   Richard   Scott   Thanh   Varun

Download this file.

COMMENTS

Feb 17, 17:10 - Scott: This module is nice as one only needs to load the the dict.txt file once per sentence instead of for each word.

Feb 17, 18:31 - Scott (line 12): join defaults to ' ' so results.join() would do the same thing.

Feb 17, 18:33 - Scott (line 13): Nerissa's program is expecting a list of offending words; returning results only is mor appropriate.

Feb 17, 18:38 - Scott (line 1): missing :

Feb 17, 20:38 - Scott (line 2): doc-string could include what the module returns

Please log in if you would like to add comments.

   

  1 def checkPassage(passageStr)  
  2     """Checks to make sure all the words in the passage are  
  3      spelled correctly.  
  4      """  
  5     file = open(dict.txt)
  6     results = []
  7     for word in passageStr:
  8         if word not in file:
  9             results.append(word)
 10         else:
 11             None
 12     glue = ' '
 13     return glue.join(results)