Assignment 3 Part 1 (submitted by Richard on Feb 9, 17:45)

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 17, 13:36 - Adam: Your program flows nicely.

Feb 17, 13:42 - Adam: Everything looks like it would work so I'm not going to change anything.

Feb 22, 18:10 - Ping: Very nice work!

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 1
  6 import spelling
  7 
  8 def count(list):
  9     dict = {}
 10     for item in list:
 11         if item in dict:
 12             dict[item] = dict[item] + 1
 13         else:
 14             dict[item] = 1
 15     return dict
 16 
 17 words = []
 18 file = open("input.txt")
 19 for line in file:
 20     words.extend(spelling.MisspelledWords(line))
 21 
 22 wordcount = {}
 23 wordcount = count(words)
 24 for item in wordcount:
 25     print item,"(",wordcount[item],")"