Difference: EmilyDickinsonExperiment (1 vs. 2)

Revision 22018-10-02 - JimSkon

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

Emily Dickinson Experiment

Line: 6 to 6
  https://repl.it/@JimSkon/EmilyDickinson
Changed:
<
<
1. Can you make the program count the number of occurences of a word?
>
>
1. What if we search for "see"? How about "see;"? How about "say", "say,', "Say", and "Say,"? what chould we do about that
 
Changed:
<
<
2. Can you print out the lines which have a given word on it?
>
>
2. Use the code from #1 to count the "was", and "was,". Why is there a difference? Consider the code below:
 
Changed:
<
<
3. Can you find and display all the lines that have a repeated word?

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

<-- SyntaxHighlightingPlugin -->
def removePunctuation(s):
  import string
  for c in string.punctuation:
    s= s.replace(c,"")
  return s
<-- end SyntaxHighlightingPlugin -->
>
>

<-- SyntaxHighlightingPlugin -->
<br />def removePunctuation(s):<br />  import string<br />  for c in string.punctuation:<br />    s= s.replace(c,"")<br />  return s<br />
<-- end SyntaxHighlightingPlugin -->
  What does this do? Call this on every line and search for "was" now?
Changed:
<
<
5. 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?
>
>
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?

4. Can you make the program count the number of occurences of a word?

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?

6. What would it take to create a list of all words, and the number of occurances?

 
Changed:
<
<
6. What would it take to create a list of all word, and the number of occurances?
>
>
7. Could we count the number of times each vowel is used?
  Solutions

Revision 12018-09-29 - JimSkon

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

Emily Dickinson Experiment

Lets read some poety, and see what we can do...

https://repl.it/@JimSkon/EmilyDickinson

1. Can you make the program count the number of occurences of a word?

2. Can you print out the lines which have a given word on it?

3. Can you find and display all the lines that have a repeated word?

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

<-- SyntaxHighlightingPlugin -->
def removePunctuation(s):
  import string
  for c in string.punctuation:
    s= s.replace(c,"")
  return s
<-- end SyntaxHighlightingPlugin -->

What does this do? Call this on every line and search for "was" now?

5. 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?

6. What would it take to create a list of all word, and the number of occurances?

Solutions

 
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