On Tue, 14 Sep 2010 08:05:33 am bob gailer wrote: > > 3.Write a program called alice_words.py that creates a text file > > named alice_words.txt containing an alphabetical listing of all the > > words found in alice_in_wonderland.txt together with the number of > > times each word occurs. The first 10 lines of your output file > > should look something like this: Word Count > > ======================= > > a 631 > > a-piece 1 > > abide 1 > > able 1 > > about 94 > > above 3 > > absence 1 > > absurd 2 > > How many times does the word, alice, occur in the book? > > We still do not have a definition of "word". Only some examples.
Nor do we have a definition of "text", "file", "alphabetical", "first", "10", "lines", "definition", or "overly pedantic". A reasonable person would use the common meaning of all of these words, unless otherwise told differently. In this case, the only ambiguity is whether hyphenated words like "a-piece" should count as two words or one, but fortunately the example above clearly shows that it should count as a single word. This is an exercise, not a RFC. Be reasonable. -- Steven D'Aprano _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor