j1-template 2022.2.2 → 2022.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/blocks/footer/boxes/contacts_box.proc +46 -18
  3. data/_includes/themes/j1/blocks/footer/boxes/links_box.proc +1 -0
  4. data/assets/data/fab.html +2 -2
  5. data/assets/data/footer.html +2 -2
  6. data/assets/themes/j1/adapter/js/analytics.js +13 -13
  7. data/assets/themes/j1/adapter/js/cookieConsent.js +1 -1
  8. data/assets/themes/j1/adapter/js/nbinteract.js +366 -120
  9. data/assets/themes/j1/core/css/themes/unodark/bootstrap.css +30 -40
  10. data/assets/themes/j1/core/css/themes/unodark/bootstrap.min.css +1 -1
  11. data/assets/themes/j1/core/css/themes/unolight/bootstrap.css +85 -216
  12. data/assets/themes/j1/core/css/themes/unolight/bootstrap.min.css +2 -2
  13. data/assets/themes/j1/core/js/template.js +1 -1
  14. data/assets/themes/j1/core/js/template.min.js +1 -1
  15. data/assets/themes/j1/core/js/template.min.js.map +1 -1
  16. data/assets/themes/j1/modules/carousel/css/theme/uno.css +5 -0
  17. data/assets/themes/j1/modules/carousel/css/theme/uno.min.css +1 -1
  18. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +1 -0
  19. data/assets/themes/j1/modules/justifiedGallery/css/justifiedGallery.css +6 -0
  20. data/assets/themes/j1/modules/justifiedGallery/css/justifiedGallery.min.css +1 -1
  21. data/assets/themes/j1/modules/mmenuLight/css/mmenu-light.css +2 -2
  22. data/assets/themes/j1/modules/mmenuLight/css/mmenu-light.min.css +1 -2
  23. data/assets/themes/j1/modules/nbInteract/README.md +169 -0
  24. data/assets/themes/j1/modules/nbInteract/css/nbinteract-core.css +4 -0
  25. data/assets/themes/j1/modules/nbInteract/css/nbinteract-core.min.css +4 -0
  26. data/assets/themes/j1/modules/nbInteract/css/theme/uno/nbinteract-core.css +33 -33
  27. data/assets/themes/j1/modules/nbInteract/css/theme/uno/nbinteract-core.min.css +1 -1
  28. data/assets/themes/j1/modules/nbInteract/js/requireJS/require.js +2068 -0
  29. data/assets/themes/j1/modules/nbInteract/js/requireJS/require.min.js +36 -0
  30. data/assets/themes/j1/modules/plotly/LICENSE +21 -0
  31. data/assets/themes/j1/modules/plotly/README.md +32 -0
  32. data/assets/themes/j1/modules/plotly/js/plotly.js +265345 -0
  33. data/assets/themes/j1/modules/plotly/js/plotly.min.js +65 -0
  34. data/assets/themes/j1/modules/requirejs/LICENSE +45 -0
  35. data/assets/themes/j1/modules/requirejs/README.md +79 -0
  36. data/assets/themes/j1/modules/requirejs/js/require.js +2068 -0
  37. data/assets/themes/j1/modules/requirejs/js/require.min.js +36 -0
  38. data/lib/j1/version.rb +1 -1
  39. data/lib/starter_web/Gemfile +1 -1
  40. data/lib/starter_web/_config.yml +1 -1
  41. data/lib/starter_web/_data/blocks/defaults/footer.yml +25 -17
  42. data/lib/starter_web/_data/blocks/footer.yml +78 -65
  43. data/lib/starter_web/_data/modules/analytics.yml +8 -23
  44. data/lib/starter_web/_data/modules/defaults/analytics.yml +1 -1
  45. data/lib/starter_web/_data/modules/defaults/cookieconsent.yml +4 -1
  46. data/lib/starter_web/_data/modules/justifiedGallery.yml +14 -8
  47. data/lib/starter_web/_data/modules/navigator_menu.yml +6 -3
  48. data/lib/starter_web/_data/modules/nbinteract.yml +12 -48
  49. data/lib/starter_web/_data/resources.yml +52 -18
  50. data/lib/starter_web/_includes/attributes.asciidoc +25 -0
  51. data/lib/starter_web/_plugins/lunr_index.rb +1 -1
  52. data/lib/starter_web/assets/images/pages/nbinteract/mandelbrot-menge-1920x1200.jpg +0 -0
  53. data/lib/starter_web/assets/images/pages/nbinteract/mandelbrot-menge.png +0 -0
  54. data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_bar.jpg +0 -0
  55. data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_hist.jpg +0 -0
  56. data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_line.jpg +0 -0
  57. data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_multiple_choice.jpg +0 -0
  58. data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_scatter.jpg +0 -0
  59. data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_scatter_drag.jpg +0 -0
  60. data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_short_answer.jpg +0 -0
  61. data/lib/starter_web/assets/images/pages/nbinteract/nbi-textbook-example.jpg +0 -0
  62. data/lib/starter_web/assets/videos/gallery/kick-it-old-school-poster.jpg +0 -0
  63. data/lib/starter_web/assets/videos/gallery/nye-party-shop-poster.jpg +0 -0
  64. data/lib/starter_web/assets/videos/gallery/stay-colorful-poster.jpg +0 -0
  65. data/lib/starter_web/collections/posts/public/series/_posts/2020-01-01-post-wiki-series.adoc +1 -0
  66. data/lib/starter_web/collections/posts/public/series/_posts/2020-01-02-post-wiki-series.adoc +1 -0
  67. data/lib/starter_web/collections/posts/public/series/_posts/2020-01-03-post-wiki-series.adoc +1 -0
  68. data/lib/starter_web/package.json +1 -2
  69. data/lib/starter_web/pages/public/jupyter/docs/_includes/documents/j1_docs_example_static.asciidoc +232 -232
  70. data/lib/starter_web/pages/public/jupyter/docs/j1-nbinteract-doc.adoc +165 -149
  71. data/lib/starter_web/pages/public/jupyter/docs/nbi-widget-manual.adoc +156 -11
  72. data/lib/starter_web/pages/public/jupyter/docs/nbinteract-doc.adoc +11 -6
  73. data/lib/starter_web/pages/public/jupyter/examples/j1-circular-times-table.adoc +136 -0
  74. data/lib/starter_web/pages/public/jupyter/examples/j1-interactive-widgets.adoc +9 -5
  75. data/lib/starter_web/pages/public/jupyter/examples/j1-odes-in-python.adoc +16 -7
  76. data/lib/starter_web/pages/public/jupyter/examples/j1-testing-plotly.adoc +95 -0
  77. data/lib/starter_web/pages/public/jupyter/examples/j1_climate-change-forecast.adoc +4 -4
  78. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/{algebra_with_sympy-checkpoint.ipynb → j1_circular_times_table-checkpoint.ipynb} +5190 -7291
  79. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_climate_change_forecast-checkpoint.ipynb +2 -2
  80. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_docs_example_dynamic-checkpoint.ipynb +1 -1
  81. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_interactive_widgets-checkpoint.ipynb +170 -15
  82. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_ode_selected-checkpoint.ipynb +1 -1
  83. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_odes_in_python-checkpoint.ipynb +520 -111
  84. data/lib/starter_web/pages/public/jupyter/notebooks/j1/factor_by_factor.mp4 +0 -0
  85. data/lib/starter_web/pages/public/jupyter/notebooks/j1/{.ipynb_checkpoints/j1_algebra_with_sympy-checkpoint.ipynb → j1_circular_times_table.ipynb} +5178 -7308
  86. data/lib/starter_web/pages/public/jupyter/notebooks/j1/j1_climate_change_forecast.ipynb +2 -2
  87. data/lib/starter_web/pages/public/jupyter/notebooks/j1/j1_docs_example_dynamic.ipynb +1 -1
  88. data/lib/starter_web/pages/public/jupyter/notebooks/j1/j1_interactive_widgets.ipynb +170 -15
  89. data/lib/starter_web/pages/public/jupyter/notebooks/j1/{j1_ode_selected.ipynb → j1_odes_in_python.ipynb} +783 -34
  90. data/lib/starter_web/pages/public/jupyter/notebooks/j1/line_by_line.mp4 +0 -0
  91. data/lib/starter_web/pages/public/jupyter/notebooks/j1/point_by_point.mp4 +0 -0
  92. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_recipes_interactive_questions-checkpoint.ipynb +185 -0
  93. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_tutorial_interact-checkpoint.ipynb +254 -0
  94. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_tutorial_monty_hall-checkpoint.ipynb +732 -0
  95. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/nbi_docs_recipes_interactive_questions.ipynb +19 -22
  96. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/nbi_docs_tutorial_monty_hall.ipynb +25 -26
  97. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_circular_times_table.html +746 -0
  98. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_climate_change_forecast.html +2 -2
  99. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_interactive_widgets.html +217 -0
  100. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_odes_in_python.html +955 -0
  101. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/nbi_docs_recipes_interactive_questions.html +1 -2
  102. data/lib/starter_web/pages/public/jupyter/{apis/binderhub-api.adoc → services/binderhub.adoc} +25 -28
  103. data/lib/starter_web/pages/public/jupyter/{apis/jupyterhub-api.adoc → services/jupyterhub.adoc} +8 -9
  104. data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.adoc +1 -1
  105. data/lib/starter_web/pages/public/learn/roundtrip/100_present_videos.adoc +9 -15
  106. data/lib/starter_web/pages/public/learn/roundtrip/200_typography.adoc +1 -1
  107. data/lib/starter_web/pages/public/learn/roundtrip/300_icon_fonts.adoc +12 -1
  108. data/lib/starter_web/pages/public/learn/roundtrip/400_asciidoc_extensions.adoc +1 -1
  109. data/lib/starter_web/pages/public/learn/roundtrip/410_bs_modals_extentions.adoc +1 -1
  110. data/lib/starter_web/pages/public/learn/roundtrip/420_responsive_tables_extensions.adoc +1 -1
  111. data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +117 -12
  112. data/lib/starter_web/pages/public/se/se-fake.adoc +47 -0
  113. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  114. data/lib/starter_web/utilsrv/package.json +1 -1
  115. metadata +41 -41
  116. data/lib/starter_web/_data/_resources.yml +0 -1668
  117. data/lib/starter_web/assets/images/pages/nbinteract/binderhub-architecture.png +0 -0
  118. data/lib/starter_web/assets/videos/gallery/adriana-lima-poster.jpg +0 -0
  119. data/lib/starter_web/pages/public/jupyter/notebooks/binder/binder-launches.ipynb +0 -385
  120. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/Untitled-checkpoint.ipynb +0 -6
  121. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/binder-launches-checkpoint.ipynb +0 -385
  122. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/climate-change-forecast-checkpoint.ipynb +0 -916
  123. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/google_altair-checkpoint.ipynb +0 -33
  124. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/ipympl_test_plots-checkpoint.ipynb +0 -14517
  125. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_altair_interactive-checkpoint.ipynb +0 -16493
  126. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_altair_interactive_test-checkpoint.ipynb +0 -14697
  127. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_altair_visualization-checkpoint.ipynb +0 -15358
  128. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_altair_visualization_full-checkpoint.ipynb +0 -2576
  129. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_climate_change_forecast.ipynb +0 -1060
  130. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_docs_hist-checkpoint.ipynb +0 -98
  131. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_interactive-checkpoint.ipynb +0 -560
  132. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_ipympl_test_plots-checkpoint.ipynb +0 -14511
  133. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_pandas_creating_reading_and_writing-checkpoint.ipynb +0 -328
  134. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_recipes_layout-checkpoint.ipynb +0 -341
  135. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/nbi_docs_recipes_graphing-checkpoint.ipynb +0 -98
  136. data/lib/starter_web/pages/public/jupyter/notebooks/j1/binder-launches.ipynb +0 -411
  137. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_examples_correlation-checkpoint.ipynb +0 -651
  138. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/binder-launches.html +0 -546
  139. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_ode_selected.html +0 -186
  140. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/excel.py +0 -55
  141. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/ggplot.py +0 -108
  142. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/ggplot2.py +0 -108
  143. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/husky.py +0 -121
  144. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/latimes.py +0 -149
  145. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/pcolor.py +0 -6
  146. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/quartz.py +0 -55
  147. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/spacy_base.py +0 -94
  148. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/spacy_mono.py +0 -158
  149. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/sunsentinel.py +0 -125
@@ -116,7 +116,7 @@
116
116
  ],
117
117
  "source": [
118
118
  "# Reading and transforming the data file\n",
119
- "url=\"https://github.com/jekyll-one/nbinteract-notebooks/raw/main/data/GlobalLandTemperaturesByMajorCity.csv.zip\"\n",
119
+ "url=\"https://github.com/jekyll-one/j1-binder-repo/raw/main/data/GlobalLandTemperaturesByMajorCity.csv.zip\"\n",
120
120
  "cities = pd.read_csv(url)\n",
121
121
  "#cities = pd.read_csv('../input/earth-surface-temperature-data/GlobalLandTemperaturesByCity.csv.zip')\n",
122
122
  "rio = cities.loc[cities['City'] == 'Rio De Janeiro', ['dt','AverageTemperature']]\n",
@@ -155,7 +155,7 @@
155
155
  " * **I(d)** is the differencing part, the `d` parameter tells how many differencing orders are going to be used, it tries to make the series stationary, example:\n",
156
156
  " \n",
157
157
  " * Yesterday I sold 10 items of a product, today I sold 14, the \"I\" in this case is just the first difference, which is +4, if you are using logarithm base this difference is equivalent to percentual difference. \n",
158
- " * If d = 1: $y_{t} = Y_{t} - Y_{t-1}$ where $y_{t}$ is the differenced series and $Y_{t-period}$ is the original series\n",
158
+ " * If d = 1: $y_{t} = Y_{t} - Y_{t-1}$ where $y_{t}$ is the differenced series and $Y_{t-p}$ is the original series\n",
159
159
  " * If d = 2: $y_{t} = (Y_{t} - Y_{t-1}) - (Y_{t-1} - Y_{t-2}) = Y_{t} - 2Y_{t-1} + Y_{t-2}$\n",
160
160
  " * Note that the second difference is a change-in-change, which is a measure of the local \"acceleration\" rather than trend.\n",
161
161
  "\n",
@@ -134,7 +134,7 @@
134
134
  {
135
135
  "data": {
136
136
  "application/vnd.jupyter.widget-view+json": {
137
- "model_id": "a82fbdc11b6e4569ba9cd58d6f999ca9",
137
+ "model_id": "a86bb7b87c514540b686a0b1078aed9b",
138
138
  "version_major": 2,
139
139
  "version_minor": 0
140
140
  },
@@ -41,7 +41,7 @@
41
41
  {
42
42
  "data": {
43
43
  "application/vnd.jupyter.widget-view+json": {
44
- "model_id": "4eaceb5cd8234e879aa37ccf538a31d6",
44
+ "model_id": "1608d7a21ea54170ac685e198f887628",
45
45
  "version_major": 2,
46
46
  "version_minor": 0
47
47
  },
@@ -76,7 +76,7 @@
76
76
  {
77
77
  "data": {
78
78
  "application/vnd.jupyter.widget-view+json": {
79
- "model_id": "3d6b668920474403b15de10bb295b481",
79
+ "model_id": "a6be50a107e24e85a292bc6145ad6d64",
80
80
  "version_major": 2,
81
81
  "version_minor": 0
82
82
  },
@@ -113,7 +113,7 @@
113
113
  {
114
114
  "data": {
115
115
  "application/vnd.jupyter.widget-view+json": {
116
- "model_id": "6859052a33504d698ce98b5b7f5681d4",
116
+ "model_id": "bba72987ae664d9c91bb7d72ea7a4ceb",
117
117
  "version_major": 2,
118
118
  "version_minor": 0
119
119
  },
@@ -150,7 +150,7 @@
150
150
  {
151
151
  "data": {
152
152
  "application/vnd.jupyter.widget-view+json": {
153
- "model_id": "68a6808e6ddc4747936e006fa70655f0",
153
+ "model_id": "623ff24264344afba1e0e2ddfaba3954",
154
154
  "version_major": 2,
155
155
  "version_minor": 0
156
156
  },
@@ -164,7 +164,7 @@
164
164
  {
165
165
  "data": {
166
166
  "application/vnd.jupyter.widget-view+json": {
167
- "model_id": "6aa8828ebccd422caa0661332bf0a2b9",
167
+ "model_id": "9498800ce6c645129e7a1d0d0960bbab",
168
168
  "version_major": 2,
169
169
  "version_minor": 0
170
170
  },
@@ -178,7 +178,7 @@
178
178
  {
179
179
  "data": {
180
180
  "application/vnd.jupyter.widget-view+json": {
181
- "model_id": "603599565d1e4c32b8ca73e690e144db",
181
+ "model_id": "a85fe7587ca741c8a763f4be2e2fbce5",
182
182
  "version_major": 2,
183
183
  "version_minor": 0
184
184
  },
@@ -192,7 +192,7 @@
192
192
  {
193
193
  "data": {
194
194
  "application/vnd.jupyter.widget-view+json": {
195
- "model_id": "214a7decf1e942aab112bf938ca002ec",
195
+ "model_id": "0589f62cfd2b47688ff5764899459a96",
196
196
  "version_major": 2,
197
197
  "version_minor": 0
198
198
  },
@@ -232,7 +232,7 @@
232
232
  {
233
233
  "data": {
234
234
  "application/vnd.jupyter.widget-view+json": {
235
- "model_id": "2d335937151540c2bd6a0bba72c2663f",
235
+ "model_id": "3a7017ac9a934ccd8c87cc9bba6561f0",
236
236
  "version_major": 2,
237
237
  "version_minor": 0
238
238
  },
@@ -309,7 +309,7 @@
309
309
  {
310
310
  "data": {
311
311
  "application/vnd.jupyter.widget-view+json": {
312
- "model_id": "a208eebaa88d4876b31b78d4fecfb417",
312
+ "model_id": "62a37ef13bf54f0cabe1c5a75d8ad7ab",
313
313
  "version_major": 2,
314
314
  "version_minor": 0
315
315
  },
@@ -363,7 +363,7 @@
363
363
  {
364
364
  "data": {
365
365
  "application/vnd.jupyter.widget-view+json": {
366
- "model_id": "63ac088b23d14aea9c259e2738e90d7f",
366
+ "model_id": "4b422c217fb84dc7bffec5159e36071a",
367
367
  "version_major": 2,
368
368
  "version_minor": 0
369
369
  },
@@ -407,7 +407,7 @@
407
407
  {
408
408
  "data": {
409
409
  "application/vnd.jupyter.widget-view+json": {
410
- "model_id": "32e2175b9733452c839dd3dcdb88bd4d",
410
+ "model_id": "dce293ca5d6f40878190033fd4bacb44",
411
411
  "version_major": 2,
412
412
  "version_minor": 0
413
413
  },
@@ -454,12 +454,12 @@
454
454
  {
455
455
  "data": {
456
456
  "application/vnd.jupyter.widget-view+json": {
457
- "model_id": "b6a7c4974d2942b4af9842ed89c0cb7f",
457
+ "model_id": "85d808e150a84179a61f5f24324eb233",
458
458
  "version_major": 2,
459
459
  "version_minor": 0
460
460
  },
461
461
  "text/plain": [
462
- "VBox(children=(Label(value='y = 1.02x + 0.48'), Figure(animation_duration=250, axes=[Axis(scale=LinearScale(ma…"
462
+ "VBox(children=(Label(value='y = 1.03x + 0.36'), Figure(animation_duration=250, axes=[Axis(scale=LinearScale(ma…"
463
463
  ]
464
464
  },
465
465
  "metadata": {},
@@ -494,7 +494,7 @@
494
494
  {
495
495
  "data": {
496
496
  "application/vnd.jupyter.widget-view+json": {
497
- "model_id": "3b81b8a5a60148238524a34452b14b8a",
497
+ "model_id": "b9ab17c9bcb4453e96247d1c3b5376b0",
498
498
  "version_major": 2,
499
499
  "version_minor": 0
500
500
  },
@@ -532,7 +532,7 @@
532
532
  {
533
533
  "data": {
534
534
  "application/vnd.jupyter.widget-view+json": {
535
- "model_id": "fc3752ade5e0411caa731b311f89300b",
535
+ "model_id": "1acc67b93a504dd68052f4f789977417",
536
536
  "version_major": 2,
537
537
  "version_minor": 0
538
538
  },
@@ -557,6 +557,161 @@
557
557
  "\n",
558
558
  "nbi.line(x_values, y_values, max=(10, 50), sd=(1, 10), options=opts)"
559
559
  ]
560
+ },
561
+ {
562
+ "cell_type": "markdown",
563
+ "metadata": {},
564
+ "source": [
565
+ "## Interactive Questions from nbinteract\n",
566
+ "nbinteract also provides built-in methods to easily create multiple choice and short answer questions.\n"
567
+ ]
568
+ },
569
+ {
570
+ "cell_type": "markdown",
571
+ "metadata": {},
572
+ "source": [
573
+ "### nbinteract.multiple_choice\n",
574
+ "\n",
575
+ "`nbinteract.multiple_choice` takes a question, a list of possible answer choices, and the correct answer. Clicking the buttons shows whether the choice was correct."
576
+ ]
577
+ },
578
+ {
579
+ "cell_type": "code",
580
+ "execution_count": 13,
581
+ "metadata": {},
582
+ "outputs": [
583
+ {
584
+ "data": {
585
+ "application/vnd.jupyter.widget-view+json": {
586
+ "model_id": "69125fc46e0a4ef98151a9a233699094",
587
+ "version_major": 2,
588
+ "version_minor": 0
589
+ },
590
+ "text/plain": [
591
+ "VBox(children=(HTML(value='<p style=\"line-height:18px;\">What is 10 + 2 * 5?</p>'), HBox(children=(Button(layou…"
592
+ ]
593
+ },
594
+ "metadata": {},
595
+ "output_type": "display_data"
596
+ }
597
+ ],
598
+ "source": [
599
+ "nbi.multiple_choice(question=\"What is 10 + 2 * 5?\",\n",
600
+ " choices=['12', '60', '20'],\n",
601
+ " answers=2)"
602
+ ]
603
+ },
604
+ {
605
+ "cell_type": "code",
606
+ "execution_count": 14,
607
+ "metadata": {
608
+ "scrolled": true
609
+ },
610
+ "outputs": [
611
+ {
612
+ "data": {
613
+ "application/vnd.jupyter.widget-view+json": {
614
+ "model_id": "7579a202c6124ff9b054ea2398505fa0",
615
+ "version_major": 2,
616
+ "version_minor": 0
617
+ },
618
+ "text/plain": [
619
+ "VBox(children=(HTML(value='<p style=\"line-height:18px;\">Select all prime numbers.</p>'), HBox(children=(Button…"
620
+ ]
621
+ },
622
+ "metadata": {},
623
+ "output_type": "display_data"
624
+ }
625
+ ],
626
+ "source": [
627
+ "nbi.multiple_choice(question=\"Select all prime numbers.\",\n",
628
+ " choices=['12', '3', '31'],\n",
629
+ " answers=[1, 2])"
630
+ ]
631
+ },
632
+ {
633
+ "cell_type": "markdown",
634
+ "metadata": {},
635
+ "source": [
636
+ "### nbinteract.short_answer\n",
637
+ "\n",
638
+ "`nbinteract.short_answer` takes a question and an answer.\n",
639
+ "\n",
640
+ "The answer can either be a string, a list of strings, or a function that returns `True` when called with the user's input. If the function errors, an error message will be displayed."
641
+ ]
642
+ },
643
+ {
644
+ "cell_type": "code",
645
+ "execution_count": 15,
646
+ "metadata": {},
647
+ "outputs": [
648
+ {
649
+ "data": {
650
+ "application/vnd.jupyter.widget-view+json": {
651
+ "model_id": "05e3ccd2d1254beab1511943bec50d2c",
652
+ "version_major": 2,
653
+ "version_minor": 0
654
+ },
655
+ "text/plain": [
656
+ "VBox(children=(HTML(value='<p style=\"line-height:18px;\">What is 1+1?</p>'), HBox(children=(Text(value='', plac…"
657
+ ]
658
+ },
659
+ "metadata": {},
660
+ "output_type": "display_data"
661
+ }
662
+ ],
663
+ "source": [
664
+ "nbi.short_answer('What is 1+1?', answers='2', explanation='1+1 is 2')"
665
+ ]
666
+ },
667
+ {
668
+ "cell_type": "code",
669
+ "execution_count": 16,
670
+ "metadata": {},
671
+ "outputs": [
672
+ {
673
+ "data": {
674
+ "application/vnd.jupyter.widget-view+json": {
675
+ "model_id": "4a1cd24a4d61497f82e0a58f51c84409",
676
+ "version_major": 2,
677
+ "version_minor": 0
678
+ },
679
+ "text/plain": [
680
+ "VBox(children=(HTML(value='<p style=\"line-height:18px;\">Enter the first name of a member of the Beatles.</p>')…"
681
+ ]
682
+ },
683
+ "metadata": {},
684
+ "output_type": "display_data"
685
+ }
686
+ ],
687
+ "source": [
688
+ "nbi.short_answer('Enter the first name of a member of the Beatles.',\n",
689
+ " ['John', 'Paul', 'George', 'Ringo'])"
690
+ ]
691
+ },
692
+ {
693
+ "cell_type": "code",
694
+ "execution_count": 17,
695
+ "metadata": {},
696
+ "outputs": [
697
+ {
698
+ "data": {
699
+ "application/vnd.jupyter.widget-view+json": {
700
+ "model_id": "d4b70f05b0234029861de4fc50bd3aef",
701
+ "version_major": 2,
702
+ "version_minor": 0
703
+ },
704
+ "text/plain": [
705
+ "VBox(children=(HTML(value='<p style=\"line-height:18px;\">Enter an even number.</p>'), HBox(children=(Text(value…"
706
+ ]
707
+ },
708
+ "metadata": {},
709
+ "output_type": "display_data"
710
+ }
711
+ ],
712
+ "source": [
713
+ "nbi.short_answer('Enter an even number.', lambda x: int(x) % 2 == 0)"
714
+ ]
560
715
  }
561
716
  ],
562
717
  "metadata": {