Anonymous user
O'Reilly Introduction to Python/Section 18: Difference between revisions
O'Reilly Introduction to Python/Section 18 (view source)
Revision as of 15:50, 15 December 2018
, 5 years ago→Step 1: construct a Python word list
Line 81:
To do this, write the code to open and read the contents of <code>sowpods.txt</code> line by line. As you go through each line in the file, build up a Python list, where each element in the list is a word from <code>sowpods.txt</code>. Note that each line in the file ends in an invisible newline, which you'll need to remove from the word.
To check your work, use the <code>len</code> function to print the length of your Python word list. It should contain 267751
<b>Step 1 resources</b>:
|