Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenDowney committed Oct 7, 2024
1 parent cfd77e8 commit 198899e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion _sources/chap00.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.14"
"version": "3.10.11"
}
},
"nbformat": 4,
Expand Down
14 changes: 7 additions & 7 deletions _sources/chap01.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@
"source": [
"Notice that the result of the division is `42.0` rather than `42`. That's because there are two types of numbers in Python: \n",
"\n",
"* **integers**, which represent whole numbers, and \n",
"* **integers**, which represent numbers with no fractional or decimal part, and \n",
"\n",
"* **floating-point numbers**, which represent numbers with a decimal point.\n",
"* **floating-point numbers**, which represent integers and numbers with a decimal point.\n",
"\n",
"If you add, subtract, or multiply two integers, the result is an integer.\n",
"But if you divide two integers, the result is a floating-point number.\n",
Expand Down Expand Up @@ -464,7 +464,7 @@
"## Arithmetic functions\n",
"\n",
"In addition to the arithmetic operators, Python provides a few **functions** that work with numbers.\n",
"For example, the `round` function takes a floating-point number and rounds it off to the nearest whole number."
"For example, the `round` function takes a floating-point number and rounds it off to the nearest integer."
]
},
{
Expand Down Expand Up @@ -845,7 +845,7 @@
"source": [
"The other arithmetic operators don't work with strings.\n",
"\n",
"Python provides a function called `len` that computes the length of a string.`"
"Python provides a function called `len` that computes the length of a string."
]
},
{
Expand Down Expand Up @@ -1388,10 +1388,10 @@
"A symbol, like `+` and `*`, that denotes an arithmetic operation like addition or multiplication.\n",
"\n",
"**integer:**\n",
"A type that represents whole numbers.\n",
"A type that represents numbers with no fractional or decimal part.\n",
"\n",
"**floating-point:**\n",
"A type that represents numbers with fractional parts.\n",
"A type that represents integers and numbers with decimal parts.\n",
"\n",
"**integer division:**\n",
"An operator, `//`, that divides two numbers and rounds down to an integer.\n",
Expand Down Expand Up @@ -1501,7 +1501,7 @@
"\n",
"* I also mentioned the order of operations. For more details, ask \"What is the order of operations in Python?\"\n",
"\n",
"* The `round` function, which we used to round a floating-point number to the nearest whole number, can take a second argument. Try asking \"What are the arguments of the round function?\" or \"How do I round pi off to three decimal places?\"\n",
"* The `round` function, which we used to round a floating-point number to the nearest integer, can take a second argument. Try asking \"What are the arguments of the round function?\" or \"How do I round pi off to three decimal places?\"\n",
"\n",
"* There's one more arithmetic operator I didn't mention; try asking \"What is the modulus operator in Python?\""
]
Expand Down
14 changes: 7 additions & 7 deletions chap01.html
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,8 @@ <h2><span class="section-number">1.1. </span>Arithmetic operators<a class="heade
</div>
<p>Notice that the result of the division is <code class="docutils literal notranslate"><span class="pre">42.0</span></code> rather than <code class="docutils literal notranslate"><span class="pre">42</span></code>. That’s because there are two types of numbers in Python:</p>
<ul class="simple">
<li><p><strong>integers</strong>, which represent whole numbers, and</p></li>
<li><p><strong>floating-point numbers</strong>, which represent numbers with a decimal point.</p></li>
<li><p><strong>integers</strong>, which represent numbers with no fractional or decimal part, and</p></li>
<li><p><strong>floating-point numbers</strong>, which represent integers and numbers with a decimal point.</p></li>
</ul>
<p>If you add, subtract, or multiply two integers, the result is an integer.
But if you divide two integers, the result is a floating-point number.
Expand Down Expand Up @@ -579,7 +579,7 @@ <h2><span class="section-number">1.2. </span>Expressions<a class="headerlink" hr
<section id="arithmetic-functions">
<h2><span class="section-number">1.3. </span>Arithmetic functions<a class="headerlink" href="#arithmetic-functions" title="Link to this heading">#</a></h2>
<p>In addition to the arithmetic operators, Python provides a few <strong>functions</strong> that work with numbers.
For example, the <code class="docutils literal notranslate"><span class="pre">round</span></code> function takes a floating-point number and rounds it off to the nearest whole number.</p>
For example, the <code class="docutils literal notranslate"><span class="pre">round</span></code> function takes a floating-point number and rounds it off to the nearest integer.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="nb">round</span><span class="p">(</span><span class="mf">42.4</span><span class="p">)</span>
Expand Down Expand Up @@ -752,7 +752,7 @@ <h2><span class="section-number">1.4. </span>Strings<a class="headerlink" href="
</div>
</div>
<p>The other arithmetic operators don’t work with strings.</p>
<p>Python provides a function called <code class="docutils literal notranslate"><span class="pre">len</span></code> that computes the length of a string.`</p>
<p>Python provides a function called <code class="docutils literal notranslate"><span class="pre">len</span></code> that computes the length of a string.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="nb">len</span><span class="p">(</span><span class="s1">&#39;Spam&#39;</span><span class="p">)</span>
Expand Down Expand Up @@ -999,9 +999,9 @@ <h2><span class="section-number">1.8. </span>Glossary<a class="headerlink" href=
<p><strong>arithmetic operator:</strong>
A symbol, like <code class="docutils literal notranslate"><span class="pre">+</span></code> and <code class="docutils literal notranslate"><span class="pre">*</span></code>, that denotes an arithmetic operation like addition or multiplication.</p>
<p><strong>integer:</strong>
A type that represents whole numbers.</p>
A type that represents numbers with no fractional or decimal part.</p>
<p><strong>floating-point:</strong>
A type that represents numbers with fractional parts.</p>
A type that represents integers and numbers with decimal parts.</p>
<p><strong>integer division:</strong>
An operator, <code class="docutils literal notranslate"><span class="pre">//</span></code>, that divides two numbers and rounds down to an integer.</p>
<p><strong>expression:</strong>
Expand Down Expand Up @@ -1064,7 +1064,7 @@ <h3><span class="section-number">1.9.1. </span>Ask a virtual assistant<a class="
<ul class="simple">
<li><p>Earlier I mentioned bitwise operators but I didn’t explain why the value of <code class="docutils literal notranslate"><span class="pre">7</span> <span class="pre">^</span> <span class="pre">2</span></code> is 5. Try asking “What are the bitwise operators in Python?” or “What is the value of <code class="docutils literal notranslate"><span class="pre">7</span> <span class="pre">XOR</span> <span class="pre">2</span></code>?”</p></li>
<li><p>I also mentioned the order of operations. For more details, ask “What is the order of operations in Python?”</p></li>
<li><p>The <code class="docutils literal notranslate"><span class="pre">round</span></code> function, which we used to round a floating-point number to the nearest whole number, can take a second argument. Try asking “What are the arguments of the round function?” or “How do I round pi off to three decimal places?”</p></li>
<li><p>The <code class="docutils literal notranslate"><span class="pre">round</span></code> function, which we used to round a floating-point number to the nearest integer, can take a second argument. Try asking “What are the arguments of the round function?” or “How do I round pi off to three decimal places?”</p></li>
<li><p>There’s one more arithmetic operator I didn’t mention; try asking “What is the modulus operator in Python?”</p></li>
</ul>
<p>Most virtual assistants know about Python, so they answer questions like this pretty reliably.
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit 198899e

Please sign in to comment.