Shakespeare: Difference between revisions

From OpenHatch wiki
imported>Zanwenhuahao
imported>Zanwenhuahao
Line 20: Line 20:
   
 
* Checking if two strings are equal
 
* Checking if two strings are equal
  +
<pre>
  +
>>> s = "mama"
  +
>>> s == "mama"
  +
True
  +
>>> s == "papa"
  +
False
  +
</pre>
 
* Checking if a string contains another as a substring
 
* Checking if a string contains another as a substring

Revision as of 07:07, 27 September 2014

Shakespeare.jpg

How many times does the word 'love' appear in Shakespeare's plays? Is it possible to find negative passages using a list of keywords? We'll use Python to practice our skills and answer questions like these.

Setup

We'll need additional setup here.

Goals

  • Have fun using Python to learn basic data science.
  • Practice searching for information in text documents
  • Practice manipulating strings
  • Practice using loops
  • Practice using lists
  • Practice using dictionaries.
  • Get experience with regular expressions.

Skills Review

  • Checking if two strings are equal
>>> s = "mama"
>>> s == "mama"
True
>>> s == "papa"
False
  • Checking if a string contains another as a substring