Skip to content

Commit 26865d4

Browse files
author
Andrew McCluskey
committed
fix string printing in types
1 parent 0e0a759 commit 26865d4

9 files changed

Lines changed: 370 additions & 12 deletions

File tree

_build/basics/types.html

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
next_page:
1212
url: /guide/01_overview.html
1313
suffix: .ipynb
14-
search: type python numbers operations not float mathematical int string example b complex variable numerical types strings performed used data point notation any above possible where standard division important addition operator also center computer boolean component however operators order equal hr three textual variables either logic str nature between error case known exactly floating due logical information true false interperator following code means does multiplication times another defined follows shown decimal atom less different line five operation returned upscaling therefore bool essentially single such particular specific function often text should inverted commas quotation marks hello world greeting run programming exercise note
14+
search: type python numbers operations not float mathematical int string example b complex variable numerical types strings performed used data point notation any above possible where standard division important addition operator also center computer boolean component however operators order equal hr three textual variables either logic str nature between means line error case known exactly floating due logical information true false should interperator following code does multiplication times another defined follows shown decimal atom less different five operation returned upscaling therefore bool essentially single such particular specific function often text inverted commas quotation marks hello world greeting run programming exercise new
1515

1616
comment: "***PROGRAMMATICALLY GENERATED, DO NOT EDIT. SEE ORIGINAL FILES IN /content***"
1717
---
@@ -256,7 +256,7 @@ <h2 id="Strings">Strings<a class="anchor-link" href="#Strings"> </a></h2><p><em>
256256

257257
<div class="inner_cell">
258258
<div class="input_area">
259-
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">hydrogen_atomic</span> <span class="o">=</span> <span class="s2">&quot;The atomic number (Z) of Hydrogen is 1. &quot;</span>
259+
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">hydrogen_atomic</span> <span class="o">=</span> <span class="s2">&quot;The atomic number (Z) of Hydrogen is 1. </span><span class="se">\n</span><span class="s2">&quot;</span>
260260
<span class="nb">print</span><span class="p">(</span><span class="n">hydrogen_atomic</span><span class="p">)</span>
261261
</pre></div>
262262

@@ -272,6 +272,7 @@ <h2 id="Strings">Strings<a class="anchor-link" href="#Strings"> </a></h2><p><em>
272272

273273
<div class="output_subarea output_stream output_stdout output_text">
274274
<pre>The atomic number (Z) of Hydrogen is 1.
275+
275276
</pre>
276277
</div>
277278
</div>
@@ -286,7 +287,7 @@ <h2 id="Strings">Strings<a class="anchor-link" href="#Strings"> </a></h2><p><em>
286287

287288
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
288289
<div class="text_cell_render border-box-sizing rendered_html">
289-
<p>In the above example, the number 1 is a component of the string <code>hydrogen</code>.
290+
<p>In the above example, the number 1 is a component of the string <code>hydrogen</code> and the <code>\n</code> means that a new line should be taken.
290291
This means that the Python interperator does not recognise it has a number so cannot perform mathematical operations (discussed below) on it.</p>
291292
<h3 id="Operations">Operations<a class="anchor-link" href="#Operations"> </a></h3><p>The textual nature of a string means that is it not possible (nor does it really make sense to) perform mathematical operations on them.
292293
However, there are some operations that can be performed on a string, that initially, may appear mathematical in nature.
@@ -319,7 +320,8 @@ <h3 id="Operations">Operations<a class="anchor-link" href="#Operations"> </a></h
319320
<div class="output_area">
320321

321322
<div class="output_subarea output_stream output_stdout output_text">
322-
<pre>The atomic number (Z) of Hydrogen is 1. The mass number (A) of Hydrogen is 1.
323+
<pre>The atomic number (Z) of Hydrogen is 1.
324+
The mass number (A) of Hydrogen is 1.
323325
</pre>
324326
</div>
325327
</div>
@@ -367,7 +369,10 @@ <h3 id="Operations">Operations<a class="anchor-link" href="#Operations"> </a></h
367369
<div class="output_area">
368370

369371
<div class="output_subarea output_stream output_stdout output_text">
370-
<pre>The atomic number (Z) of Hydrogen is 1. The atomic number (Z) of Hydrogen is 1. The atomic number (Z) of Hydrogen is 1.
372+
<pre>The atomic number (Z) of Hydrogen is 1.
373+
The atomic number (Z) of Hydrogen is 1.
374+
The atomic number (Z) of Hydrogen is 1.
375+
371376
</pre>
372377
</div>
373378
</div>

_build/features/interactive_cells.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,10 @@ <h2 id="Using-interactive-widgets-on-your-page">Using interactive widgets on you
225225

226226

227227

228-
<div id="ba53f095-7a97-4cb4-b7d0-06dec2afdfd8"></div>
228+
<div id="e561512d-ecf4-42f5-aa1b-7440d2e50cbd"></div>
229229
<div class="output_subarea output_widget_view ">
230230
<script type="text/javascript">
231-
var element = $('#ba53f095-7a97-4cb4-b7d0-06dec2afdfd8');
231+
var element = $('#e561512d-ecf4-42f5-aa1b-7440d2e50cbd');
232232
</script>
233233
<script type="application/vnd.jupyter.widget-view+json">
234234
{"model_id": "7db97110f70e4753addb351e55df6af6", "version_major": 2, "version_minor": 0}
-2.54 KB
Loading
1.51 KB
Loading

_build/images/number_line.png

41.1 KB
Loading

_build/images/number_line.svg

Lines changed: 174 additions & 0 deletions
Loading

content/basics/types.ipynb

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,20 +153,21 @@
153153
"name": "stdout",
154154
"output_type": "stream",
155155
"text": [
156-
"The atomic number (Z) of Hydrogen is 1. \n"
156+
"The atomic number (Z) of Hydrogen is 1. \n",
157+
"\n"
157158
]
158159
}
159160
],
160161
"source": [
161-
"hydrogen_atomic = \"The atomic number (Z) of Hydrogen is 1. \"\n",
162+
"hydrogen_atomic = \"The atomic number (Z) of Hydrogen is 1. \\n\"\n",
162163
"print(hydrogen_atomic)"
163164
]
164165
},
165166
{
166167
"cell_type": "markdown",
167168
"metadata": {},
168169
"source": [
169-
"In the above example, the number 1 is a component of the string `hydrogen`. \n",
170+
"In the above example, the number 1 is a component of the string `hydrogen` and the `\\n` means that a new line should be taken.\n",
170171
"This means that the Python interperator does not recognise it has a number so cannot perform mathematical operations (discussed below) on it.\n",
171172
"\n",
172173
"### Operations\n",
@@ -185,7 +186,8 @@
185186
"name": "stdout",
186187
"output_type": "stream",
187188
"text": [
188-
"The atomic number (Z) of Hydrogen is 1. The mass number (A) of Hydrogen is 1. \n"
189+
"The atomic number (Z) of Hydrogen is 1. \n",
190+
"The mass number (A) of Hydrogen is 1. \n"
189191
]
190192
}
191193
],
@@ -215,7 +217,10 @@
215217
"name": "stdout",
216218
"output_type": "stream",
217219
"text": [
218-
"The atomic number (Z) of Hydrogen is 1. The atomic number (Z) of Hydrogen is 1. The atomic number (Z) of Hydrogen is 1. \n"
220+
"The atomic number (Z) of Hydrogen is 1. \n",
221+
"The atomic number (Z) of Hydrogen is 1. \n",
222+
"The atomic number (Z) of Hydrogen is 1. \n",
223+
"\n"
219224
]
220225
}
221226
],

content/images/number_line.png

41.1 KB
Loading

0 commit comments

Comments
 (0)