Assignment 3 Part 4 (submitted by Richard on Feb 9, 17:47)

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:59 - Kevin: nice simple module. perhaps should have implemented if the word is checkable in the module

Please log in if you would like to add comments.

   

  1 # Richard Shiao
  2 # CS198-Python
  3 # 2003-02-09
  4 
  5 # Craft 3, Part 4
  6 import re
  7 true = 1
  8 dictfile = open(file)
  9 dict = {}
 10 for line in dictfile:
 11     pat = re.compile('(\n)')
 12     entry = pat.sub('',line)
 13     dict[entry] = true
 14 
 15 def checkword(word):
 16     """Returns true (1) if the single word is spelled correctly."""
 17     return dict.get(word)