Skip to content

Commit 8faa5e3

Browse files
committed
Website build
1 parent 6da0c55 commit 8faa5e3

File tree

8 files changed

+143
-35
lines changed

8 files changed

+143
-35
lines changed

2_programs_in_files.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ <h3><span class="section-number">2.2.1. </span>Installing packages from PyPI<a c
117117
<p><a class="reference external" href="https://pypi.org">PyPI</a> is the Python Package Index. It is the
118118
official download location for publicly released Python packages which
119119
aren’t themselves a part of the built-in <a class="reference external" href="https://docs.python.org/3/library/index.html" title="(in Python v3.9)"><span class="xref std std-doc">Python Standard Library</span></a>. Many important mathematical packages
120-
including <a class="reference external" href="https://numpy.org/doc/stable/reference/index.html#module-numpy" title="(in NumPy v1.19)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">numpy</span></code></a> and <a class="reference external" href="https://www.sympy.org">sympy</a> are
121-
distributed from PyPI. Suppose your venv doesn’t have <a class="reference external" href="https://numpy.org/doc/stable/reference/index.html#module-numpy" title="(in NumPy v1.19)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">numpy</span></code></a>
120+
including <a class="reference external" href="https://numpy.org/doc/stable/reference/index.html#module-numpy" title="(in NumPy v1.20)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">numpy</span></code></a> and <a class="reference external" href="https://www.sympy.org">sympy</a> are
121+
distributed from PyPI. Suppose your venv doesn’t have <a class="reference external" href="https://numpy.org/doc/stable/reference/index.html#module-numpy" title="(in NumPy v1.20)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">numpy</span></code></a>
122122
installed and you need it. You would install it with the following
123123
terminal command:</p>
124124
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp gp-VirtualEnv">(my_venv)</span> <span class="gp">$</span> python -m pip install numpy
@@ -396,14 +396,14 @@ <h3><span class="section-number">2.5.2. </span>Other forms of import<a class="he
396396
don’t really want to write <a class="reference external" href="https://docs.python.org/3/library/math.html#math.sin" title="(in Python v3.9)"><code class="xref py py-func docutils literal notranslate"><span class="pre">math.sin()</span></code></a> in every trig formula you
397397
ever write. One alternative is to rename the module on import. This is
398398
achieved using the keyword <a class="reference external" href="https://docs.python.org/3/reference/simple_stmts.html#import" title="(in Python v3.9)"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">as</span></code></a> in an import statement. For example,
399-
it is usual to import the numerical Python module <a class="reference external" href="https://numpy.org/doc/stable/reference/index.html#module-numpy" title="(in NumPy v1.19)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">numpy</span></code></a> in the
399+
it is usual to import the numerical Python module <a class="reference external" href="https://numpy.org/doc/stable/reference/index.html#module-numpy" title="(in NumPy v1.20)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">numpy</span></code></a> in the
400400
following way:</p>
401401
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
402402
</pre></div>
403403
</div>
404-
<p>This creates the local name <a class="reference external" href="https://numpy.org/doc/stable/reference/index.html#module-numpy" title="(in NumPy v1.19)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">np</span></code></a> instead of <a class="reference external" href="https://numpy.org/doc/stable/reference/index.html#module-numpy" title="(in NumPy v1.19)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">numpy</span></code></a>,
404+
<p>This creates the local name <a class="reference external" href="https://numpy.org/doc/stable/reference/index.html#module-numpy" title="(in NumPy v1.20)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">np</span></code></a> instead of <a class="reference external" href="https://numpy.org/doc/stable/reference/index.html#module-numpy" title="(in NumPy v1.20)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">numpy</span></code></a>,
405405
so that the function for creating an evenly spaced sequence of values
406-
between to end points is now accessible as <a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.linspace.html#numpy.linspace" title="(in NumPy v1.19)"><code class="xref py py-func docutils literal notranslate"><span class="pre">np.linspace</span></code></a>.</p>
406+
between to end points is now accessible as <a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.linspace.html#numpy.linspace" title="(in NumPy v1.20)"><code class="xref py py-func docutils literal notranslate"><span class="pre">np.linspace</span></code></a>.</p>
407407
<p>A second option is to import particular names from a module directly
408408
into the current namespace. For example, if we planned to use the
409409
functions <a class="reference external" href="https://docs.python.org/3/library/math.html#math.sin" title="(in Python v3.9)"><code class="xref py py-func docutils literal notranslate"><span class="pre">math.sin()</span></code></a> and <a class="reference external" href="https://docs.python.org/3/library/math.html#math.cos" title="(in Python v3.9)"><code class="xref py py-func docutils literal notranslate"><span class="pre">math.cos()</span></code></a> a lot in our script, we
@@ -650,7 +650,7 @@ <h2><span class="section-number">2.7. </span>Testing frameworks<a class="headerl
650650
the practical details of including tests in your code here.</p>
651651
<p>There are a number of Python packages which support code testing. The
652652
concepts are largely similar so rather than get bogged down in the
653-
details of multiple frameworks, we will introduce <a class="reference external" href="https://docs.pytest.org/en/latest/index.html" title="(in pytest v6.3.0.dev104+gd4f8e4b40)"><span class="xref std std-doc">pytest</span></a>, which is one of the most widely used. Pytest is simply a Python
653+
details of multiple frameworks, we will introduce <a class="reference external" href="https://docs.pytest.org/en/latest/index.html" title="(in pytest v6.3.0.dev194+g16e21c22a)"><span class="xref std std-doc">pytest</span></a>, which is one of the most widely used. Pytest is simply a Python
654654
package, so you can install it into your current environment using:</p>
655655
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$</span> python -m pip install pytest
656656
</pre></div>

4_style.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ <h3><span class="section-number">4.7.3. </span>Short docstrings<a class="headerl
10021002
<div class="section" id="long-docstrings">
10031003
<h3><span class="section-number">4.7.4. </span>Long docstrings<a class="headerlink" href="#long-docstrings" title="Permalink to this headline"></a></h3>
10041004
<p>Conversely, a more complex object will require much more information in its
1005-
docstring. Consider <a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.array.html#numpy.array" title="(in NumPy v1.19)"><code class="xref py py-func docutils literal notranslate"><span class="pre">numpy.array()</span></code></a> (click on the link for the
1005+
docstring. Consider <a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.array.html#numpy.array" title="(in NumPy v1.20)"><code class="xref py py-func docutils literal notranslate"><span class="pre">numpy.array()</span></code></a> (click on the link for the
10061006
documentation). The web documentation, also generated from the docstring, needs
10071007
to cover 5 parameters, and detail the return type. It also contains several
10081008
examples, references to other functions, and an explanatory note. This is an
@@ -1185,7 +1185,7 @@ <h2><span class="section-number">4.10. </span>Exercises<a class="headerlink" hre
11851185
reflected or rotated.</p>
11861186
<ol class="arabic simple">
11871187
<li><p>Add a class <code class="xref py py-class docutils literal notranslate"><span class="pre">Pattern</span></code> to <code class="xref py py-mod docutils literal notranslate"><span class="pre">life.life</span></code>. The <a class="reference internal" href="3_objects.html#term-constructor"><span class="xref std std-term">constructor</span></a> should
1188-
take in a <a class="reference external" href="https://numpy.org/doc/stable/reference/index.html#module-numpy" title="(in NumPy v1.19)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">numpy</span></code></a> array containing a pattern of 1s and 0s, and
1188+
take in a <a class="reference external" href="https://numpy.org/doc/stable/reference/index.html#module-numpy" title="(in NumPy v1.20)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">numpy</span></code></a> array containing a pattern of 1s and 0s, and
11891189
assign it to the <a class="reference internal" href="3_objects.html#term-attribute"><span class="xref std std-term">attribute</span></a> <code class="xref py py-obj docutils literal notranslate"><span class="pre">grid</span></code>.</p></li>
11901190
<li><p>Add <code class="xref py py-class docutils literal notranslate"><span class="pre">Pattern</span></code> to the <a class="reference external" href="https://docs.python.org/3/reference/simple_stmts.html#import" title="(in Python v3.9)"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">import</span></code></a> statement in
11911191
<code class="xref py py-mod docutils literal notranslate"><span class="pre">life.__init__</span></code>.</p></li>

7_midterm.html

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,12 @@
7676
<div class="section" id="test-format">
7777
<h2><span class="section-number">7.1. </span>Test format<a class="headerlink" href="#test-format" title="Permalink to this headline"></a></h2>
7878
<p>The final exam will be two hours long and comprise 4 questions, each of which
79-
will be marked out of 20. The midterm test will be one hour long, so to keep the
80-
question format consistent with the final exam, there will be two questions.
81-
Each question will be subdivided into identified parts with a specified number
82-
of marks associated with each.</p>
79+
will be marked out of 20. The midterm test will be 40 minutes long, so to keep
80+
the question format consistent with the final exam, there will a single
81+
question. The extra 10 minutes is to give you some flexibility, because in the
82+
final exam you could spend more time on some questions than others. The
83+
question will be subdivided into identified parts with a specified number of
84+
marks associated with each.</p>
8385
<p>The test will work using GitHub Classroom. The link to accept the test
8486
“assignment” will be distributed at the start time of the test, simultaneously in the
8587
course Teams channel, by email, and in the Piazza forum. The test repository
@@ -103,7 +105,7 @@ <h2><span class="section-number">7.2. </span>The mark scheme<a class="headerlink
103105
optimal <a class="reference internal" href="5_abstract_data_types.html#term-algorithmic-complexity"><span class="xref std std-term">algorithmic complexity</span></a>, and be elegant and readable. The tests
104106
provided are an aid to writing correct code: passing the tests does not prove
105107
that your answer is correct. For example, your code could produce the correct
106-
output in the cases test but nonetheless fail to implement the specification in
108+
output in the cases tested but nonetheless fail to implement the specification in
107109
the question. For the avoidance of doubt, a correct answer is one which
108110
correctly implements the specification, not simply one which passes the tests
109111
provided.</p>
@@ -114,18 +116,18 @@ <h2><span class="section-number">7.2. </span>The mark scheme<a class="headerlink
114116
</div>
115117
<div class="section" id="using-git-in-the-test">
116118
<h2><span class="section-number">7.3. </span>Using git in the test<a class="headerlink" href="#using-git-in-the-test" title="Permalink to this headline"></a></h2>
117-
<p>You should clone the test repository into the folder you created for the course,
118-
just like you have been doing for the exercise repositories. This will help
119-
ensure that you are programming in the same environment you have been using all
120-
along, and therefore avoid any unfortunate misconfiguration surprises in the
121-
test.</p>
119+
<p>You should accept the test from GitHub classroom, and clone the test repository
120+
into the folder you created for the course, just like you have been doing for
121+
the exercise repositories. This will help ensure that you are programming in
122+
the same environment you have been using all along, and therefore avoid any
123+
unfortunate misconfiguration surprises in the test.</p>
122124
<p>This is a test of programming as a whole, so using git correctly is a part of
123125
the test. This has some consequences for how you should go about the test:</p>
124126
<ol class="arabic simple">
125127
<li><p>Commit <em>and</em> push your work as you go along. Do not rely on committing once
126128
at the end of the test. You will be marked on what you have pushed to GitHub
127129
at the end of the test period. If the first time that you try to push
128-
something to GitHub is at the end of the hour, and something goes wrong, then
130+
something to GitHub is at the end of the test time, and something goes wrong, then
129131
you will receive 0% for the test, because you will not have pushed any
130132
answers.</p></li>
131133
<li><p>Don’t forget to <code class="xref py py-obj docutils literal notranslate"><span class="pre">git</span> <span class="pre">add</span></code> any files you need to create. If you don’t add them
@@ -154,7 +156,7 @@ <h2><span class="section-number">7.4. </span>Preparing for the test<a class="hea
154156
questions here. Each of these is a question similar in format and length to the
155157
questions on the exam. Just like on the exam, the question is specified in the
156158
<code class="file docutils literal notranslate"><span class="pre">README.rst</span></code> file in the exercise repository. When you first attempt each
157-
of these exercises, you should set yourself a 30 minute timer and see what you
159+
of these exercises, you should set yourself a 40 minute timer and see what you
158160
can get done (and committed and pushed!) in the time you would have in the test.
159161
After that, if you haven’t finished, then go on and finish the exercise.
160162
Programming is a practical discipline, and finishing one exercise will make you

8_inheritance.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,8 +783,8 @@ <h2><span class="section-number">8.6. </span>Exercises<a class="headerlink" href
783783
order <code class="xref py py-obj docutils literal notranslate"><span class="pre">n</span></code>. You will need to implement the group operation and the validation
784784
of group element values. Group elements can be represented by sequences
785785
containing permutations of the integers from 0 to <code class="xref py py-obj docutils literal notranslate"><span class="pre">n-1</span></code>. You will find it
786-
advantageous to convert these permutations to <a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.array.html#numpy.array" title="(in NumPy v1.19)"><code class="xref py py-func docutils literal notranslate"><span class="pre">numpy.array()</span></code></a> using
787-
<a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.asarray.html#numpy.asarray" title="(in NumPy v1.19)"><code class="xref py py-func docutils literal notranslate"><span class="pre">numpy.asarray()</span></code></a> because the indexing rules for that type mean that the
786+
advantageous to convert these permutations to <a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.array.html#numpy.array" title="(in NumPy v1.20)"><code class="xref py py-func docutils literal notranslate"><span class="pre">numpy.array()</span></code></a> using
787+
<a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.asarray.html#numpy.asarray" title="(in NumPy v1.20)"><code class="xref py py-func docutils literal notranslate"><span class="pre">numpy.asarray()</span></code></a> because the indexing rules for that type mean that the
788788
group operation can simply be implemented by indexing the first permutation
789789
with the second: <code class="xref py py-obj docutils literal notranslate"><span class="pre">a[b]</span></code>.</p>
790790
<p>You will also need to set the <a class="reference internal" href="#term-class-attribute"><span class="xref std std-term">class attribute</span></a> <code class="xref py py-obj docutils literal notranslate"><span class="pre">notation</span></code>. For this

0 commit comments

Comments
 (0)