Skip to content

Commit 7a21129

Browse files
committed
Ending code cells with a semicolon.
1 parent 192fe87 commit 7a21129

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

Chapter4_TheGreatestTheoremNeverTold/LawOfLargeNumbers.ipynb

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
"expected value\" )\n",
111111
"plt.ylabel(\"average of $n$ samples\")\n",
112112
"plt.xlabel(\"# of samples, $n$\")\n",
113-
"plt.legend()\n"
113+
"plt.legend();"
114114
],
115115
"language": "python",
116116
"metadata": {},
@@ -185,7 +185,7 @@
185185
"plt.plot(N_array, np.sqrt(expected_value) / np.sqrt(N_array), lw=2, ls=\"--\",\n",
186186
" label=r\"$\\frac{\\sqrt{\\lambda}}{\\sqrt{N}}$\")\n",
187187
"plt.legend()\n",
188-
"plt.title(\"How 'fast' is the sample average converging? \")\n"
188+
"plt.title(\"How 'fast' is the sample average converging? \");"
189189
],
190190
"language": "python",
191191
"metadata": {},
@@ -244,7 +244,7 @@
244244
"input": [
245245
"import pymc as pm\n",
246246
"N = 10000\n",
247-
"print np.mean([pm.rexponential(0.5) > 10 for i in range(N)])\n"
247+
"print np.mean([pm.rexponential(0.5) > 10 for i in range(N)]);"
248248
],
249249
"language": "python",
250250
"metadata": {},
@@ -333,7 +333,7 @@
333333
"plt.ylabel(\"Average height in county\")\n",
334334
"plt.plot([100, 1500], [150, 150], color=\"k\", label=\"true expected \\\n",
335335
"height\", ls=\"--\")\n",
336-
"plt.legend(scatterpoints=1)\n"
336+
"plt.legend(scatterpoints=1);"
337337
],
338338
"language": "python",
339339
"metadata": {},
@@ -366,7 +366,7 @@
366366
"print population[np.argsort(average_across_county)[:10]]\n",
367367
"print\n",
368368
"print \"Population sizes of 10 'tallest' counties: \"\n",
369-
"print population[np.argsort(-average_across_county)[:10]]\n"
369+
"print population[np.argsort(-average_across_county)[:10]];"
370370
],
371371
"language": "python",
372372
"metadata": {},
@@ -419,7 +419,7 @@
419419
" edgecolors=\"#A60628\", linewidths=1.5,\n",
420420
" label=\"most extreme points\")\n",
421421
"\n",
422-
"plt.legend(scatterpoints=1)\n"
422+
"plt.legend(scatterpoints=1);"
423423
],
424424
"language": "python",
425425
"metadata": {},
@@ -498,7 +498,7 @@
498498
"# adding a number to the end of the %run call with get the ith top photo.\n",
499499
"%run top_pic_comments.py 2\n",
500500
"\n",
501-
"Image(top_post_url)\n"
501+
"Image(top_post_url);"
502502
],
503503
"language": "python",
504504
"metadata": {},
@@ -537,7 +537,7 @@
537537
"for i in comments:\n",
538538
" print '\"' + contents[i] + '\"'\n",
539539
" print\"upvotes/downvotes: \", votes[i, :]\n",
540-
" print\n"
540+
" print;"
541541
],
542542
"language": "python",
543543
"metadata": {},
@@ -596,7 +596,7 @@
596596
" map_ = pm.MAP([upvote_ratio, observations]).fit()\n",
597597
" mcmc = pm.MCMC([upvote_ratio, observations])\n",
598598
" mcmc.sample(samples, samples / 4)\n",
599-
" return mcmc.trace(\"upvote_ratio\")[:]\n"
599+
" return mcmc.trace(\"upvote_ratio\")[:];"
600600
],
601601
"language": "python",
602602
"metadata": {},
@@ -628,7 +628,7 @@
628628
"\n",
629629
"plt.legend(loc=\"upper left\")\n",
630630
"plt.xlim(0, 1)\n",
631-
"plt.title(\"Posterior distributions of upvote ratios on different comments\")\n"
631+
"plt.title(\"Posterior distributions of upvote ratios on different comments\");"
632632
],
633633
"language": "python",
634634
"metadata": {},
@@ -695,7 +695,7 @@
695695
"plt.legend(loc=\"upper left\")\n",
696696
"plt.title(\"Posterior distributions of upvote ratios on different comments\")\n",
697697
"order = np.argsort(-np.array(lower_limits))\n",
698-
"print order, lower_limits\n"
698+
"print order, lower_limits;"
699699
],
700700
"language": "python",
701701
"metadata": {},
@@ -767,7 +767,7 @@
767767
"for i in order[:40]:\n",
768768
" ordered_contents.append(contents[i])\n",
769769
" print votes[i, 0], votes[i, 1], contents[i]\n",
770-
" print \"-------------\"\n"
770+
" print \"-------------\";"
771771
],
772772
"language": "python",
773773
"metadata": {},
@@ -906,7 +906,7 @@
906906
" color=\"#7A68A6\")\n",
907907
"plt.xlim(0.3, 1)\n",
908908
"plt.yticks(np.arange(len(r_order) - 1, -1, -1),\n",
909-
" map(lambda x: x[:30].replace(\"\\n\", \"\"), ordered_contents))\n"
909+
" map(lambda x: x[:30].replace(\"\\n\", \"\"), ordered_contents));"
910910
],
911911
"language": "python",
912912
"metadata": {},
@@ -1020,7 +1020,7 @@
10201020
"exp = stats.expon(scale=4)\n",
10211021
"N = 1e5\n",
10221022
"X = exp.rvs(N)\n",
1023-
"# ...\n"
1023+
"# ...;"
10241024
],
10251025
"language": "python",
10261026
"metadata": {},
@@ -1101,7 +1101,7 @@
11011101
"def css_styling():\n",
11021102
" styles = open(\"../styles/custom.css\", \"r\").read()\n",
11031103
" return HTML(styles)\n",
1104-
"css_styling()\n"
1104+
"css_styling();"
11051105
],
11061106
"language": "python",
11071107
"metadata": {},

0 commit comments

Comments
 (0)