j1-template 2022.2.2 → 2022.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_includes/themes/j1/blocks/footer/boxes/contacts_box.proc +46 -18
- data/_includes/themes/j1/blocks/footer/boxes/links_box.proc +1 -0
- data/assets/data/fab.html +2 -2
- data/assets/data/footer.html +2 -2
- data/assets/themes/j1/core/css/themes/unolight/bootstrap.css +64 -206
- data/assets/themes/j1/core/css/themes/unolight/bootstrap.min.css +2 -2
- data/assets/themes/j1/modules/nbInteract/README.md +169 -0
- data/assets/themes/j1/modules/nbInteract/css/nbinteract-core.css +4 -0
- data/assets/themes/j1/modules/nbInteract/css/nbinteract-core.min.css +4 -0
- data/lib/j1/version.rb +1 -1
- data/lib/starter_web/Gemfile +1 -1
- data/lib/starter_web/_config.yml +1 -1
- data/lib/starter_web/_data/blocks/defaults/footer.yml +25 -17
- data/lib/starter_web/_data/blocks/footer.yml +78 -65
- data/lib/starter_web/_data/resources.yml +0 -22
- data/lib/starter_web/_includes/attributes.asciidoc +14 -0
- data/lib/starter_web/_plugins/lunr_index.rb +1 -1
- data/lib/starter_web/assets/images/pages/nbinteract/nbi-textbook-example.jpg +0 -0
- data/lib/starter_web/package.json +1 -1
- data/lib/starter_web/pages/public/jupyter/docs/_includes/documents/j1_docs_example_static.asciidoc +232 -232
- data/lib/starter_web/pages/public/jupyter/docs/j1-nbinteract-doc.adoc +135 -134
- data/lib/starter_web/pages/public/jupyter/docs/nbi-widget-manual.adoc +2 -4
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_interactive_widgets-checkpoint.ipynb +170 -15
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/j1_interactive_widgets.ipynb +170 -15
- data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_recipes_interactive_questions-checkpoint.ipynb +185 -0
- data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/nbi_docs_recipes_interactive_questions.ipynb +19 -22
- data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/binder-launches.html +670 -546
- data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_docs_example_dynamic.html +186 -186
- data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_interactive_widgets.html +919 -702
- data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_ode_selected.html +186 -186
- data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/nbi_docs_recipes_interactive_questions.html +242 -243
- data/lib/starter_web/pages/public/jupyter/{apis/binderhub-api.adoc → services/binderhub.adoc} +22 -25
- data/lib/starter_web/pages/public/jupyter/{apis/jupyterhub-api.adoc → services/jupyterhub.adoc} +2 -2
- data/lib/starter_web/pages/public/learn/roundtrip/300_icon_fonts.adoc +11 -0
- data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
- data/lib/starter_web/utilsrv/package.json +1 -1
- metadata +7 -28
- data/lib/starter_web/_data/_resources.yml +0 -1668
- data/lib/starter_web/assets/images/pages/nbinteract/binderhub-architecture.png +0 -0
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/algebra_with_sympy-checkpoint.ipynb +0 -14488
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/climate-change-forecast-checkpoint.ipynb +0 -916
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/ipympl_test_plots-checkpoint.ipynb +0 -14517
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_algebra_with_sympy-checkpoint.ipynb +0 -14517
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_altair_interactive-checkpoint.ipynb +0 -16493
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_altair_visualization-checkpoint.ipynb +0 -15358
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_altair_visualization_full-checkpoint.ipynb +0 -2576
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_climate_change_forecast-checkpoint.ipynb +0 -1058
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_climate_change_forecast.ipynb +0 -1060
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_docs_example_dynamic-checkpoint.ipynb +0 -14478
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_docs_hist-checkpoint.ipynb +0 -98
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_interactive-checkpoint.ipynb +0 -560
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_ipympl_test_plots-checkpoint.ipynb +0 -14511
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_ode_selected-checkpoint.ipynb +0 -14478
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_odes_in_python-checkpoint.ipynb +0 -14818
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_pandas_creating_reading_and_writing-checkpoint.ipynb +0 -328
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_recipes_layout-checkpoint.ipynb +0 -341
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/nbi_docs_recipes_graphing-checkpoint.ipynb +0 -98
- data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_examples_correlation-checkpoint.ipynb +0 -651
- data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_examples_variability_of_the_sample_mean-checkpoint.ipynb +0 -323
- data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_recipes_graphing-checkpoint.ipynb +0 -387
- data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_recipes_layout-checkpoint.ipynb +0 -384
@@ -41,7 +41,7 @@
|
|
41
41
|
{
|
42
42
|
"data": {
|
43
43
|
"application/vnd.jupyter.widget-view+json": {
|
44
|
-
"model_id": "
|
44
|
+
"model_id": "80e67011ebc84f819837e00a9a151d93",
|
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": "
|
79
|
+
"model_id": "20e6d0d9cac14ebab29bda33d4d07025",
|
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": "
|
116
|
+
"model_id": "bdfdc73016c74c08833477aed43de354",
|
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": "
|
153
|
+
"model_id": "96cfd375bcd84467b6ab5714dab866ff",
|
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": "
|
167
|
+
"model_id": "de20afd9dd5941e1a356c2f98aad1d88",
|
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": "
|
181
|
+
"model_id": "c60655e5c5824bc9a8cd6d9fc9654fae",
|
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": "
|
195
|
+
"model_id": "2b3c300ad62d4e7f8ce50e66c8e3685d",
|
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": "
|
235
|
+
"model_id": "5f48de7d6d504bbb8efe421d05030f87",
|
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": "
|
312
|
+
"model_id": "640034312037443a86719cbda69dc6db",
|
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": "
|
366
|
+
"model_id": "22f14116bf2640cbb1d89c62e72c39dc",
|
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": "
|
410
|
+
"model_id": "a2fc988f50b24e8ebb8694b59ca6b7ec",
|
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": "
|
457
|
+
"model_id": "53d035e1b2774af382452721ecd593dc",
|
458
458
|
"version_major": 2,
|
459
459
|
"version_minor": 0
|
460
460
|
},
|
461
461
|
"text/plain": [
|
462
|
-
"VBox(children=(Label(value='y = 1.
|
462
|
+
"VBox(children=(Label(value='y = 1.01x + 0.50'), 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": "
|
497
|
+
"model_id": "c81a6645722a45f79685c75a3d0f208b",
|
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": "
|
535
|
+
"model_id": "3921246d9d9b445f9fb0dc0c6a2ec2b8",
|
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": "801dde29de334eb39603b878ebf4f3d0",
|
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": "4fef9b0a8cae4cf4a22ac74d8221f695",
|
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": "867f68ecb6eb4b0a8c45ab598ae0471e",
|
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": "01f92e3dbe7148729b04e85d1946a750",
|
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": "a4fc0e9264374e7b9c8dbb3e4122f8d5",
|
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": {
|
@@ -0,0 +1,185 @@
|
|
1
|
+
{
|
2
|
+
"cells": [
|
3
|
+
{
|
4
|
+
"cell_type": "markdown",
|
5
|
+
"metadata": {},
|
6
|
+
"source": [
|
7
|
+
"### Interactive Questions\n",
|
8
|
+
"nbinteract also provides built-in methods to easily create multiple choice and short answer questions."
|
9
|
+
]
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"cell_type": "code",
|
13
|
+
"execution_count": 1,
|
14
|
+
"metadata": {},
|
15
|
+
"outputs": [],
|
16
|
+
"source": [
|
17
|
+
"import nbinteract as nbi"
|
18
|
+
]
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"cell_type": "markdown",
|
22
|
+
"metadata": {},
|
23
|
+
"source": [
|
24
|
+
"#### nbinteract.multiple_choice\n",
|
25
|
+
"\n",
|
26
|
+
"`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."
|
27
|
+
]
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"cell_type": "code",
|
31
|
+
"execution_count": 7,
|
32
|
+
"metadata": {},
|
33
|
+
"outputs": [
|
34
|
+
{
|
35
|
+
"data": {
|
36
|
+
"application/vnd.jupyter.widget-view+json": {
|
37
|
+
"model_id": "5e2cf7e8eff64a6aaf9dfcad8cfa63eb",
|
38
|
+
"version_major": 2,
|
39
|
+
"version_minor": 0
|
40
|
+
},
|
41
|
+
"text/plain": [
|
42
|
+
"VBox(children=(HTML(value='<p style=\"line-height:18px;\">What is 10 + 2 * 5?</p>'), HBox(children=(Button(layou…"
|
43
|
+
]
|
44
|
+
},
|
45
|
+
"metadata": {},
|
46
|
+
"output_type": "display_data"
|
47
|
+
}
|
48
|
+
],
|
49
|
+
"source": [
|
50
|
+
"nbi.multiple_choice(question=\"What is 10 + 2 * 5?\",\n",
|
51
|
+
" choices=['12', '60', '20'],\n",
|
52
|
+
" answers=2)"
|
53
|
+
]
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"cell_type": "code",
|
57
|
+
"execution_count": 8,
|
58
|
+
"metadata": {},
|
59
|
+
"outputs": [
|
60
|
+
{
|
61
|
+
"data": {
|
62
|
+
"application/vnd.jupyter.widget-view+json": {
|
63
|
+
"model_id": "29e1ab27776a49b0b832c241d449c92a",
|
64
|
+
"version_major": 2,
|
65
|
+
"version_minor": 0
|
66
|
+
},
|
67
|
+
"text/plain": [
|
68
|
+
"VBox(children=(HTML(value='<p style=\"line-height:18px;\">Select all prime numbers.</p>'), HBox(children=(Button…"
|
69
|
+
]
|
70
|
+
},
|
71
|
+
"metadata": {},
|
72
|
+
"output_type": "display_data"
|
73
|
+
}
|
74
|
+
],
|
75
|
+
"source": [
|
76
|
+
"nbi.multiple_choice(question=\"Select all prime numbers.\",\n",
|
77
|
+
" choices=['12', '3', '31'],\n",
|
78
|
+
" answers=[1, 2])"
|
79
|
+
]
|
80
|
+
},
|
81
|
+
{
|
82
|
+
"cell_type": "markdown",
|
83
|
+
"metadata": {},
|
84
|
+
"source": [
|
85
|
+
"#### nbinteract.short_answer\n",
|
86
|
+
"\n",
|
87
|
+
"`nbinteract.short_answer` takes a question and an answer. 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."
|
88
|
+
]
|
89
|
+
},
|
90
|
+
{
|
91
|
+
"cell_type": "code",
|
92
|
+
"execution_count": 9,
|
93
|
+
"metadata": {},
|
94
|
+
"outputs": [
|
95
|
+
{
|
96
|
+
"data": {
|
97
|
+
"application/vnd.jupyter.widget-view+json": {
|
98
|
+
"model_id": "e30f724e97bf4d5fac072777e3fe1d45",
|
99
|
+
"version_major": 2,
|
100
|
+
"version_minor": 0
|
101
|
+
},
|
102
|
+
"text/plain": [
|
103
|
+
"VBox(children=(HTML(value='<p style=\"line-height:18px;\">What is 1+1?</p>'), HBox(children=(Text(value='', plac…"
|
104
|
+
]
|
105
|
+
},
|
106
|
+
"metadata": {},
|
107
|
+
"output_type": "display_data"
|
108
|
+
}
|
109
|
+
],
|
110
|
+
"source": [
|
111
|
+
"nbi.short_answer('What is 1+1?', answers='2', explanation='1+1 is 2')"
|
112
|
+
]
|
113
|
+
},
|
114
|
+
{
|
115
|
+
"cell_type": "code",
|
116
|
+
"execution_count": 10,
|
117
|
+
"metadata": {},
|
118
|
+
"outputs": [
|
119
|
+
{
|
120
|
+
"data": {
|
121
|
+
"application/vnd.jupyter.widget-view+json": {
|
122
|
+
"model_id": "c171c255bbb74f289fe3211f41430ab6",
|
123
|
+
"version_major": 2,
|
124
|
+
"version_minor": 0
|
125
|
+
},
|
126
|
+
"text/plain": [
|
127
|
+
"VBox(children=(HTML(value='<p style=\"line-height:18px;\">Enter the first name of a member of the Beatles.</p>')…"
|
128
|
+
]
|
129
|
+
},
|
130
|
+
"metadata": {},
|
131
|
+
"output_type": "display_data"
|
132
|
+
}
|
133
|
+
],
|
134
|
+
"source": [
|
135
|
+
"nbi.short_answer('Enter the first name of a member of the Beatles.',\n",
|
136
|
+
" ['John', 'Paul', 'George', 'Ringo'])"
|
137
|
+
]
|
138
|
+
},
|
139
|
+
{
|
140
|
+
"cell_type": "code",
|
141
|
+
"execution_count": 6,
|
142
|
+
"metadata": {},
|
143
|
+
"outputs": [
|
144
|
+
{
|
145
|
+
"data": {
|
146
|
+
"application/vnd.jupyter.widget-view+json": {
|
147
|
+
"model_id": "84b47630b6bf4e8f9f318d8502e161f3",
|
148
|
+
"version_major": 2,
|
149
|
+
"version_minor": 0
|
150
|
+
},
|
151
|
+
"text/plain": [
|
152
|
+
"VBox(children=(HTML(value='<p style=\"line-height:18px;\">Enter an even number.</p>'), HBox(children=(Text(value…"
|
153
|
+
]
|
154
|
+
},
|
155
|
+
"metadata": {},
|
156
|
+
"output_type": "display_data"
|
157
|
+
}
|
158
|
+
],
|
159
|
+
"source": [
|
160
|
+
"nbi.short_answer('Enter an even number.', lambda x: int(x) % 2 == 0)"
|
161
|
+
]
|
162
|
+
}
|
163
|
+
],
|
164
|
+
"metadata": {
|
165
|
+
"kernelspec": {
|
166
|
+
"display_name": "Python 3",
|
167
|
+
"language": "python",
|
168
|
+
"name": "python3"
|
169
|
+
},
|
170
|
+
"language_info": {
|
171
|
+
"codemirror_mode": {
|
172
|
+
"name": "ipython",
|
173
|
+
"version": 3
|
174
|
+
},
|
175
|
+
"file_extension": ".py",
|
176
|
+
"mimetype": "text/x-python",
|
177
|
+
"name": "python",
|
178
|
+
"nbconvert_exporter": "python",
|
179
|
+
"pygments_lexer": "ipython3",
|
180
|
+
"version": "3.7.9"
|
181
|
+
}
|
182
|
+
},
|
183
|
+
"nbformat": 4,
|
184
|
+
"nbformat_minor": 2
|
185
|
+
}
|
@@ -4,8 +4,7 @@
|
|
4
4
|
"cell_type": "markdown",
|
5
5
|
"metadata": {},
|
6
6
|
"source": [
|
7
|
-
"### Interactive Questions",
|
8
|
-
"\n",
|
7
|
+
"### Interactive Questions\n",
|
9
8
|
"nbinteract also provides built-in methods to easily create multiple choice and short answer questions."
|
10
9
|
]
|
11
10
|
},
|
@@ -29,18 +28,18 @@
|
|
29
28
|
},
|
30
29
|
{
|
31
30
|
"cell_type": "code",
|
32
|
-
"execution_count":
|
31
|
+
"execution_count": 7,
|
33
32
|
"metadata": {},
|
34
33
|
"outputs": [
|
35
34
|
{
|
36
35
|
"data": {
|
37
36
|
"application/vnd.jupyter.widget-view+json": {
|
38
|
-
"model_id": "
|
37
|
+
"model_id": "5e2cf7e8eff64a6aaf9dfcad8cfa63eb",
|
39
38
|
"version_major": 2,
|
40
39
|
"version_minor": 0
|
41
40
|
},
|
42
41
|
"text/plain": [
|
43
|
-
"
|
42
|
+
"VBox(children=(HTML(value='<p style=\"line-height:18px;\">What is 10 + 2 * 5?</p>'), HBox(children=(Button(layou…"
|
44
43
|
]
|
45
44
|
},
|
46
45
|
"metadata": {},
|
@@ -55,18 +54,18 @@
|
|
55
54
|
},
|
56
55
|
{
|
57
56
|
"cell_type": "code",
|
58
|
-
"execution_count":
|
57
|
+
"execution_count": 8,
|
59
58
|
"metadata": {},
|
60
59
|
"outputs": [
|
61
60
|
{
|
62
61
|
"data": {
|
63
62
|
"application/vnd.jupyter.widget-view+json": {
|
64
|
-
"model_id": "
|
63
|
+
"model_id": "29e1ab27776a49b0b832c241d449c92a",
|
65
64
|
"version_major": 2,
|
66
65
|
"version_minor": 0
|
67
66
|
},
|
68
67
|
"text/plain": [
|
69
|
-
"
|
68
|
+
"VBox(children=(HTML(value='<p style=\"line-height:18px;\">Select all prime numbers.</p>'), HBox(children=(Button…"
|
70
69
|
]
|
71
70
|
},
|
72
71
|
"metadata": {},
|
@@ -85,25 +84,23 @@
|
|
85
84
|
"source": [
|
86
85
|
"#### nbinteract.short_answer\n",
|
87
86
|
"\n",
|
88
|
-
"`nbinteract.short_answer` takes a question and an answer
|
89
|
-
"\n",
|
90
|
-
"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."
|
87
|
+
"`nbinteract.short_answer` takes a question and an answer. 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."
|
91
88
|
]
|
92
89
|
},
|
93
90
|
{
|
94
91
|
"cell_type": "code",
|
95
|
-
"execution_count":
|
92
|
+
"execution_count": 9,
|
96
93
|
"metadata": {},
|
97
94
|
"outputs": [
|
98
95
|
{
|
99
96
|
"data": {
|
100
97
|
"application/vnd.jupyter.widget-view+json": {
|
101
|
-
"model_id": "
|
98
|
+
"model_id": "e30f724e97bf4d5fac072777e3fe1d45",
|
102
99
|
"version_major": 2,
|
103
100
|
"version_minor": 0
|
104
101
|
},
|
105
102
|
"text/plain": [
|
106
|
-
"
|
103
|
+
"VBox(children=(HTML(value='<p style=\"line-height:18px;\">What is 1+1?</p>'), HBox(children=(Text(value='', plac…"
|
107
104
|
]
|
108
105
|
},
|
109
106
|
"metadata": {},
|
@@ -116,18 +113,18 @@
|
|
116
113
|
},
|
117
114
|
{
|
118
115
|
"cell_type": "code",
|
119
|
-
"execution_count":
|
116
|
+
"execution_count": 10,
|
120
117
|
"metadata": {},
|
121
118
|
"outputs": [
|
122
119
|
{
|
123
120
|
"data": {
|
124
121
|
"application/vnd.jupyter.widget-view+json": {
|
125
|
-
"model_id": "
|
122
|
+
"model_id": "c171c255bbb74f289fe3211f41430ab6",
|
126
123
|
"version_major": 2,
|
127
124
|
"version_minor": 0
|
128
125
|
},
|
129
126
|
"text/plain": [
|
130
|
-
"
|
127
|
+
"VBox(children=(HTML(value='<p style=\"line-height:18px;\">Enter the first name of a member of the Beatles.</p>')…"
|
131
128
|
]
|
132
129
|
},
|
133
130
|
"metadata": {},
|
@@ -141,18 +138,18 @@
|
|
141
138
|
},
|
142
139
|
{
|
143
140
|
"cell_type": "code",
|
144
|
-
"execution_count":
|
141
|
+
"execution_count": 6,
|
145
142
|
"metadata": {},
|
146
143
|
"outputs": [
|
147
144
|
{
|
148
145
|
"data": {
|
149
146
|
"application/vnd.jupyter.widget-view+json": {
|
150
|
-
"model_id": "
|
147
|
+
"model_id": "84b47630b6bf4e8f9f318d8502e161f3",
|
151
148
|
"version_major": 2,
|
152
149
|
"version_minor": 0
|
153
150
|
},
|
154
151
|
"text/plain": [
|
155
|
-
"
|
152
|
+
"VBox(children=(HTML(value='<p style=\"line-height:18px;\">Enter an even number.</p>'), HBox(children=(Text(value…"
|
156
153
|
]
|
157
154
|
},
|
158
155
|
"metadata": {},
|
@@ -166,7 +163,7 @@
|
|
166
163
|
],
|
167
164
|
"metadata": {
|
168
165
|
"kernelspec": {
|
169
|
-
"display_name": "Python
|
166
|
+
"display_name": "Python 3",
|
170
167
|
"language": "python",
|
171
168
|
"name": "python3"
|
172
169
|
},
|
@@ -180,7 +177,7 @@
|
|
180
177
|
"name": "python",
|
181
178
|
"nbconvert_exporter": "python",
|
182
179
|
"pygments_lexer": "ipython3",
|
183
|
-
"version": "3.
|
180
|
+
"version": "3.7.9"
|
184
181
|
}
|
185
182
|
},
|
186
183
|
"nbformat": 4,
|