Assignment 3 Part 4 (submitted by Omair on Feb 10, 15:57)

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

Please log in if you would like to add comments.

   

  1 import re
  2 
  3 def isword(string):
  4         pat = re.compile('[a-zA-Z]+')
  5         match = pat.search(string)
  6         str = match.group()
  7         if str == string:
  8                 return 1
  9         else:
 10                 return 0
 11 
 12 def findword(word):
 13         dict = open('dict.txt')
 14         for line in dict:
 15                 line0 = line.strip()
 16                 if line0 == word:
 17                         return 1
 18                 word0 = word[0].lower() + word[1:len(word)]
 19                 if line0 == word0:
 20                         return 1
 21         return 0