Skip to content

Commit 798472f

Browse files
committed
Built site for gh-pages
1 parent b815b57 commit 798472f

14 files changed

Lines changed: 122 additions & 122 deletions

File tree

.nojekyll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
dfeb6ffe
1+
ab209866

01-intro/programming-basics.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -568,19 +568,19 @@ <h2 class="anchored" data-anchor-id="names-and-call-expressions">Names and Call
568568
</div>
569569
</div>
570570
<p>One analogy for names is suitcase tags. Consider the following assignment statement:</p>
571-
<div id="a559351c" class="cell" data-execution_count="1">
571+
<div id="81764f43" class="cell" data-execution_count="1">
572572
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>x <span class="op">=</span> <span class="dv">3</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
573573
</div>
574574
<p>This statement assigns the name <code>x</code> to the value <code>3</code>. Like a suitcase tag, the name <code>x</code> is bound to the value <code>3</code>.</p>
575-
<div id="4bd65c6c" class="cell" data-execution_count="2">
575+
<div id="b255a698" class="cell" data-execution_count="2">
576576
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>x</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
577577
<div class="cell-output cell-output-display" data-execution_count="2">
578578
<pre><code>3</code></pre>
579579
</div>
580580
</div>
581581
<p>Python first evaluates the expression on the right-hand side of the <code>=</code> assignment operator, then binds the name <code>x</code> to the resulting value.</p>
582582
<p>The below statement re-assigns the name <code>x</code>. Think of this as moving the suitcase tag to a different suitcase.</p>
583-
<div id="13469920" class="cell" data-execution_count="3">
583+
<div id="2bd84df9" class="cell" data-execution_count="3">
584584
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a>x <span class="op">=</span> <span class="dv">1</span> <span class="op">+</span> <span class="dv">2</span> <span class="op">*</span> <span class="dv">3</span> <span class="op">-</span> <span class="dv">4</span> <span class="op">//</span> <span class="dv">5</span></span>
585585
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a>x</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
586586
<div class="cell-output cell-output-display" data-execution_count="3">
@@ -605,7 +605,7 @@ <h3 class="anchored" data-anchor-id="a-note-on-function-calls">A note on functio
605605
</div>
606606
</div>
607607
<p>Consider the below Python code:</p>
608-
<div id="c64e7794" class="cell" data-execution_count="4">
608+
<div id="376acafd" class="cell" data-execution_count="4">
609609
<div class="sourceCode cell-code" id="cb6"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a>x <span class="op">=</span> <span class="dv">4</span></span>
610610
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a>y <span class="op">=</span> <span class="bu">max</span>(<span class="op">-</span><span class="dv">2</span>, <span class="dv">9</span>) <span class="op">+</span> x</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
611611
</div>
@@ -621,7 +621,7 @@ <h3 class="anchored" data-anchor-id="programming-style-and-comments">Programming
621621
<p>Good style practices can involve comments, meaningful names, whitespace, markdown cells interspersed with code cells, etc. <a href="https://inferentialthinking.com/chapters/03/2/Names.html">Ch 3.2</a> of <em>Inferential Thinking</em> describes meaningful names; we discuss comments below.</p>
622622
<p><strong>Comments</strong> are used to explain what code does. Good programmers write code that is self-evident and use comments only where necessary.</p>
623623
<p>In Python, you can write comments in the same line as code (“in-line” comments) using <code>#</code>:</p>
624-
<div id="9cf6c251" class="cell" data-execution_count="5">
624+
<div id="6dfdf530" class="cell" data-execution_count="5">
625625
<div class="sourceCode cell-code" id="cb7"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="dv">3</span> <span class="op">+</span> <span class="dv">4</span> <span class="co"># simple arithmetic</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
626626
<div class="cell-output cell-output-display" data-execution_count="5">
627627
<pre><code>7</code></pre>
@@ -646,7 +646,7 @@ <h3 class="anchored" data-anchor-id="debugging">Debugging</h3>
646646
<h3 class="anchored" data-anchor-id="practice-with-errors">Practice with Errors</h3>
647647
<p>Try these on for size:</p>
648648
<p><strong>Syntax errors</strong> are errors in writing “valid” Python that cannot even create nonsensical Python code.</p>
649-
<div id="85842cae" class="cell" data-execution_count="6">
649+
<div id="82f61049" class="cell" data-execution_count="6">
650650
<div class="sourceCode cell-code" id="cb9"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="dv">3</span> <span class="op">**</span> <span class="op">/</span> <span class="dv">4</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
651651
<div class="cell-output cell-output-error">
652652
<div class="ansi-escaped-output">
@@ -659,14 +659,14 @@ <h3 class="anchored" data-anchor-id="practice-with-errors">Practice with Errors<
659659
</div>
660660
</div>
661661
<p>Why might the below code <em>not</em> error? (Hint: What does <code>-</code> represent?)</p>
662-
<div id="d01e647a" class="cell" data-execution_count="7">
662+
<div id="ef8ba74d" class="cell" data-execution_count="7">
663663
<div class="sourceCode cell-code" id="cb10"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="dv">9</span> <span class="op">**</span> <span class="op">-</span> <span class="fl">.5</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
664664
<div class="cell-output cell-output-display" data-execution_count="7">
665665
<pre><code>0.3333333333333333</code></pre>
666666
</div>
667667
</div>
668668
<p>Once you fix syntax errors, you may still encounter <strong>functionality errors</strong>, which can be errors caused during execution that leads to your program crashing. Here’s one common one:</p>
669-
<div id="5c2df77b" class="cell" data-execution_count="8">
669+
<div id="0a50d3dc" class="cell" data-execution_count="8">
670670
<div class="sourceCode cell-code" id="cb12"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="dv">5</span> <span class="op">/</span> <span class="dv">0</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
671671
<div class="cell-output cell-output-error">
672672
<div class="ansi-escaped-output">

02-datatypes/index.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -533,20 +533,20 @@ <h2 class="anchored" data-anchor-id="strings">Strings</h2>
533533
</div>
534534
</div>
535535
<p><strong>Concatenation operation</strong>: The <code>+</code> operator works differently on string data types. Instead of adding numerically, it “adds textually,” which is more formally called <strong>concatenation</strong>:</p>
536-
<div id="e21e9bac" class="cell" data-execution_count="1">
536+
<div id="e6a85b45" class="cell" data-execution_count="1">
537537
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="dv">2</span> <span class="op">+</span> <span class="dv">3</span> <span class="co"># addition</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
538538
<div class="cell-output cell-output-display" data-execution_count="1">
539539
<pre><code>5</code></pre>
540540
</div>
541541
</div>
542-
<div id="13142931" class="cell" data-execution_count="2">
542+
<div id="55334353" class="cell" data-execution_count="2">
543543
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="co">'hello'</span> <span class="op">+</span> <span class="st">"donuts"</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
544544
<div class="cell-output cell-output-display" data-execution_count="2">
545545
<pre><code>'hellodonuts'</code></pre>
546546
</div>
547547
</div>
548548
<p><strong>Length function</strong>: There is one function not shown above that would be useful to you know, and that is <code>len(s)</code>, which takes a string argument and returns its length.</p>
549-
<div id="94d6dc64" class="cell" data-execution_count="3">
549+
<div id="bb272ddb" class="cell" data-execution_count="3">
550550
<div class="sourceCode cell-code" id="cb5"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a>s <span class="op">=</span> <span class="st">"hello world"</span></span>
551551
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="bu">len</span>(s)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
552552
<div class="cell-output cell-output-display" data-execution_count="3">
@@ -557,14 +557,14 @@ <h2 class="anchored" data-anchor-id="strings">Strings</h2>
557557
<section id="boolean-data-type" class="level2">
558558
<h2 class="anchored" data-anchor-id="boolean-data-type">Boolean Data Type</h2>
559559
<p>The Boolean data type (<code>bool</code>) has exactly two values: <code>True</code> and <code>False</code>. Note that boolean values are <em>not</em> strings!</p>
560-
<div id="0a307a5e" class="cell" data-execution_count="4">
560+
<div id="06ad606c" class="cell" data-execution_count="4">
561561
<div class="sourceCode cell-code" id="cb7"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a>b <span class="op">=</span> <span class="va">True</span></span>
562562
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a>b</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
563563
<div class="cell-output cell-output-display" data-execution_count="4">
564564
<pre><code>True</code></pre>
565565
</div>
566566
</div>
567-
<div id="67cce3ce" class="cell" data-execution_count="5">
567+
<div id="b500f50a" class="cell" data-execution_count="5">
568568
<div class="sourceCode cell-code" id="cb9"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a>b <span class="op">=</span> <span class="va">False</span></span>
569569
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="bu">type</span>(b)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
570570
<div class="cell-output cell-output-display" data-execution_count="5">
@@ -576,14 +576,14 @@ <h2 class="anchored" data-anchor-id="boolean-data-type">Boolean Data Type</h2>
576576
<section id="typecasting" class="level2">
577577
<h2 class="anchored" data-anchor-id="typecasting">Typecasting</h2>
578578
<p>We can also <strong>typecast</strong>, or convert values between data types. These typecasting functions take in one typed argument and return another typed argument, then return that value as a different type. The function name is generally the type. Note that data type conversion is only valid “when it makes sense.” We’ll talk about this more later.</p>
579-
<div id="543a2362" class="cell" data-execution_count="6">
579+
<div id="752dc79e" class="cell" data-execution_count="6">
580580
<div class="sourceCode cell-code" id="cb11"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a>x <span class="op">=</span> <span class="dv">3</span> <span class="co"># what type is x?</span></span>
581581
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a><span class="bu">str</span>(x) <span class="co"># returns a value of type string</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
582582
<div class="cell-output cell-output-display" data-execution_count="6">
583583
<pre><code>'3'</code></pre>
584584
</div>
585585
</div>
586-
<div id="72f79c92" class="cell" data-execution_count="7">
586+
<div id="2d95ba19" class="cell" data-execution_count="7">
587587
<div class="sourceCode cell-code" id="cb13"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a>s <span class="op">=</span> <span class="st">"5"</span> <span class="co"># what type is x?</span></span>
588588
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a><span class="bu">float</span>(s) <span class="co"># what type is returned?</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
589589
<div class="cell-output cell-output-display" data-execution_count="7">

02-datatypes/rates-incidence.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,15 +691,15 @@ <h2 class="anchored" data-anchor-id="verifying-incidence">Verifying Incidence</h
691691
</div>
692692
</div>
693693
<p>Let’s use <a href="#eq-p100k" class="quarto-xref">Equation&nbsp;3</a> to compute TB incidence in the U.S. in 2020:</p>
694-
<div id="a9019b4a" class="cell" data-execution_count="1">
694+
<div id="9ee86c51" class="cell" data-execution_count="1">
695695
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="dv">7173</span> <span class="op">/</span> <span class="dv">331501080</span> <span class="op">*</span> <span class="dv">100000</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
696696
<div class="cell-output cell-output-display" data-execution_count="1">
697697
<pre><code>2.1637938555132306</code></pre>
698698
</div>
699699
</div>
700700
<p>Rounding to the nearest tenth spot, we get the original quoted rate, 2.2!</p>
701701
<p>The previous cell makes little sense without the prior intense exposition. Python names and comments make everything more understandable:</p>
702-
<div id="d3f0a999" class="cell" data-execution_count="2">
702+
<div id="a443dad8" class="cell" data-execution_count="2">
703703
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="co"># compute incidence as cases per 100k</span></span>
704704
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a>pop_2020 <span class="op">=</span> <span class="dv">331501080</span></span>
705705
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a>tb_2020 <span class="op">=</span> <span class="dv">7173</span></span>

0 commit comments

Comments
 (0)