Difference: EmilyDickinsonExperiment (3 vs. 4)

Revision 42019-02-09 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="IntroToCSF2018"

Emily Dickinson Experiment

Changed:
<
<
Lets read some poety, and see what we can do...
>
>
1. Lets' read some poety, and see what we can do...
 
Changed:
<
<
https://repl.it/@JimSkon/EmilyDickinson
>
>
https://repl.it/@JimSkon/EmilyDickinson1
 
Changed:
<
<
1. What if we search for "see"? How about "see;"? How about "say", "say,', "Say", and "Say,"? what chould we do about that
>
>
2. Could we count the number of times each vowel is used?
 
Changed:
<
<
2. Use the code from #1 to count the "was", and "was,". Why is there a difference? Consider the code below:
>
>
3. Can we break the lines into words?
 
Changed:
<
<

%CODE{"python"}%
>
>
https://repl.it/@JimSkon/EmilyDickinson2

4. Can we make a function countWords(word) to ask for a word and then count it?

5. What if we search for "see"? How about "see;"? How about "say", "say,', "Say", and "Say,"? What could we do about this?

6. Use the code from #3 to count the "was", and "was,". Why is there a difference? Consider the code below:

%CODE{"python"}%

 def removePunctuation(s): import string for c in string.punctuation:
Line: 18 to 26
  return s %ENDCODE%
Changed:
<
<
What does this do? Call this on every line and search for "was" now?

3. Consider the function s.lower(), where s is a string. What does it do? How might this be useful in the find repeated word code?

>
>
What does this code do? Call this on every line and search for "was". What changed?
 
Changed:
<
<
4. Can you make the program count the number of occurences of a word?
>
>
7. Consider the function s.lower(), where s is a string. What does it do? How might this be useful to counts words?
 
Changed:
<
<
5. Can you find and display all the lines that have a repeated word? Can you include the word, and the number of occurances in the line for ech repeated word?
>
>
8. Can you find and display all the lines that have a repeated word? Can you include the word, and the number of occurances in the line for each repeated word?
 
Changed:
<
<
6. What would it take to create a list of all words, and the number of occurances?
>
>
9. What would it take to create a list of all of the unique words and write them to a file, one word per line? Try it.
 
Changed:
<
<
7. Could we count the number of times each vowel is used?
>
>
10. Comment your code and thurn it in.
  Solutions \ No newline at end of file
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback