Assignment 3 Part 1 (submitted by Derek on Feb 10, 15:59)

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   Rosie   Scott   Thanh   Varun

Download this file.

COMMENTS

Feb 13, 21:31 - Nadia: Code is pretty easy to read, and it looks like you worked out the whole capitalization and punctuation thing with Jacob. You might have wanted to proofread for simple errors before submitting (ie, "spelling", "lookup" without module name...) even if it was difficult to test completely.

Feb 22, 17:48 - Ping: Quite nice, though doesn't sort the results.

Please log in if you would like to add comments.

   

  1 #!/usr/bin/python
  2 
  3 import spelling
  4 
  5 notfound = {}
  6 
  7 #setdict(dict.txt)
  8 
  9 file = open('input.txt')
 10 for line in file:
 11         for word in line.split():
 12                 validchars = re.compile('[^A-Za-z\']')
 13                 word = validchars.sub('', word);
 14                 if not lookup(word):
 15                         notfound[word] = notfound.get(word,0) + 1
 16 
 17 for key in notfound.keys():
 18         print key + " (" + str(notfound.get(key)) + ")"