Skip to content

Commit

Permalink
Fixes to files for MOOC
Browse files Browse the repository at this point in the history
  • Loading branch information
barbarer committed Jun 26, 2024
1 parent bd0f189 commit a771de9
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 5 deletions.
2 changes: 1 addition & 1 deletion _sources/files/mixedupCode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ you can hide it again by clicking on the Hide button.

.. raw:: html

<pre id="uspoll.txt">
<pre id="uspoll">
Aberdeen, SD :13 :8
Adrian, MI :15 :9
Akron, OH :18 :11
Expand Down
4 changes: 4 additions & 0 deletions _sources/files/mixedupCode_orig.rst
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ Mixed-up Code Questions
=====
return(num)

.. datafile:: dogs.txt
:fromfile: dogs.txt
:hide:

.. activecode:: file_count_lines_starting_with_ac
:practice: T
:autograde: unittest
Expand Down
6 changes: 5 additions & 1 deletion _sources/files/openingFiles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ For learning purposes, we are using the shortened version of this file
Click on the button to show the first lines from this file.


.. reveal:: mbox-short.txt
.. reveal:: mbox-short
:showtitle: Show
:hidetitle: Hide

Expand Down Expand Up @@ -75,6 +75,10 @@ Click on the button to show the first lines from this file.
X-DSPAM-Probability: 0.0000
.. datafile:: mbox-short.txt
:fromfile: mbox-short.txt
:hide:

.. activecode:: fileOpen
:caption: Opening a file
:datafile: mbox-short.txt
Expand Down
4 changes: 4 additions & 0 deletions _sources/files/readingFiles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ While the *file handle* object does not contain the actual data in the
file, it is quite easy to construct a ``for`` loop to read
through and count each of the lines in a file:

.. datafile:: mbox-short.txt
:fromfile: mbox-short.txt
:hide:

.. activecode:: fileLines
:caption: Opening and counting the lines in a file
:datafile: mbox-short.txt
Expand Down
4 changes: 4 additions & 0 deletions _sources/files/searching.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ started with the prefix "From:", we could use the string method
*startswith* to select only those lines with the desired
prefix:

.. datafile:: mbox-short.txt
:fromfile: mbox-short.txt
:hide:

.. activecode:: fileFrom
:caption: Printing lines starting with "From:"
:datafile: mbox-short.txt
Expand Down
18 changes: 15 additions & 3 deletions _sources/files/writeCode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ and hide to put it away.

.. raw:: html

<pre id="uspoll.txt">
<pre id="uspoll">
Aberdeen, SD :13 :8
Adrian, MI :15 :9
Akron, OH :18 :11
Expand Down Expand Up @@ -393,6 +393,10 @@ and hide to put it away.
Yuma, AZ :14 :9
</pre>

.. datafile:: uspoll.txt
:fromfile: uspoll.txt
:hide:

#.
.. tabbed:: file_ex_pollError

Expand Down Expand Up @@ -581,7 +585,7 @@ and hide to put it away.

The following file contains a set of emotions that will be used in the next question.

.. reveal:: emotion_words.txt
.. reveal:: emotion_words
:showtitle: Show
:hidetitle: Hide

Expand All @@ -595,6 +599,10 @@ The following file contains a set of emotions that will be used in the next ques
Scared afraid fearful panicked terrified petrified startled
Nervous anxious jittery jumpy tense uneasy apprehensive
.. datafile:: emotion_words.txt
:fromfile: emotion_words.txt
:hide:
#.
.. activecode:: file_ex_emotionq
:datafile: emotion_words.txt
Expand Down Expand Up @@ -627,7 +635,7 @@ is the first three letters of the month.

.. raw:: html

<pre id="stocks.txt">
<pre id="stocks">
3-Dec-01,9848.93,10220.78,9651.87,10021.57
1-Nov-01,9087.45,10054.58,8987.61,9851.56
1-Oct-01,8845.97,9626.54,8659.9,9075.14
Expand Down Expand Up @@ -786,6 +794,10 @@ is the first three letters of the month.
3-Jan-89,2168.39,2350.18,2127.14,2342.32
</pre>

.. datafile:: stocks.txt
:fromfile: stocks.txt
:hide:

#.
.. tabbed:: file_ex_biggestLoss

Expand Down

0 comments on commit a771de9

Please sign in to comment.