Re: Python in K-12: good news (they're using Jupyter)
Wes Turner <[email protected]> Thu, 25 Jan 2024 21:51:58 -0500
| Newsgroups | gmane.comp.python.education |
|---|---|
| Message-ID | <CACfEFw8-aY8LrmUuAkEkSE3xCwG536VcFkk5NyjO3z=oSaMDrQ@mail.gmail.com> |
--===============0754692157443355938==
Content-Type: multipart/alternative; boundary="000000000000dc18b2060fd0612e"
--000000000000dc18b2060fd0612e
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Notebooks and Spreadsheets often lack test assertions; which are critical
to quality
"Spreadsheet errors can have disastrous consequences =E2=80=93 yet we keep =
making
them" (2024) https://news.ycombinator.com/item?id=3D39132512
"""
What are some Software Development methods for reducing errors:
1. AUTOMATED TESTS; test assertions
To write spreadsheet tests:
A. Write your own test assertion library for their macro language; write
assertEqual() in VBscript and Apps Script.
B. Use another language with a test library and a test runner; e.g. Python
and the `assert` keyword, unittest.TestCase().assertEqual() or pytest.
C. Test the spreadsheet GUI with something like AutoHotKey.
>From https://news.ycombinator.com/item?id=3D35896192 :
> The Scientific Method is testing, so testing (tests, assertions,
fixtures) should be core to any scientific workflow system.
> awesome-jupyter#testing:
https://github.com/markusschanta/awesome-jupyter#testing
> ml-tooling/best-of-jupyter lists papermill/papermill under "Interactive
Widgets/Visualization"
https://github.com/ml-tooling/best-of-jupyter#interactive-wi...
"""
TIL about K-16:
- K12CS: K-12 CS
- Q12: Quantum K12
- P-12: Pre-K - 12
Exercise:
- 1. Khanmigo > Tutoring help in Math > ~ask for review questions in
[addition of 3 digit numbers]
- 2. Create a notebook in e.g. JupyterLite. This is in the "percent format"
that jupytext and various other IDEs support. `# %%` is the input cell
delimiter:
```python
# %%
321+123
# %%
x =3D 321
y =3D 321 + 123
print([x, y])
# %%
assert 321 + 123 =3D=3D 444
assert 444 - 321 =3D=3D 123
# %%
import unittest; test =3D unittest.TestCase()
test.assertEqual(321+123, 444)
test.assertEqual(444-321, 123)
test.assertEqual(444-123, 321)
# %%
test_cases =3D [
[1,2, 3],
[123, 321, 444],
[100, 214, 314],
#[1, 2, 5]
]
for a,b,c in test_cases:
test.assertEqual(a+b, c)
test.assertEqual(c-b, a)
test.assertEqual(c-a, b)
# %%
print([a, b, c])
print(f"Hello World: {x} + {y} =3D {z}")
```
; Test assertions for Science
On Thu, Jan 25, 2024, 7:43=E2=80=AFPM kirby urner <[email protected]> w=
rote:
>
> Thanks for jumping in David.
>
> I concur, the Excel environment is a productive "home base" for deriving
> the visualizations and is in many cases is sufficient.
>
> In the Office model, one is then expected to embed said visualizations in
> a Word document, perhaps exporting to PDF, if wanting to add more verbiag=
e
> and/or make it more journal article or textbook like. [1]
>
> In your type of advocacy work, maybe getting the visualizations is
> sufficient, and indeed, the final step from Jupyter Notebook to a PDF
> version is sometimes the trickiest, when it comes to page breaks especial=
ly.
>
> Here's a Notebook in the same ballpark, dealing with the half life of
> naturally occurring and/or artificially generated radioactive substances:
>
>
> https://nbviewer.org/github/4dsolutions/School_of_Tomorrow/blob/master/is=
otope_decay.ipynb
>
> This is the classic synergy of Jupyter + pandas + matplotlib, the kind of
> thing I've been teaching through a Turkey-based company. [2]
>
> I don't see it as either / or, and true, Jupyter might be the wrong tool
> in many instances. I wonder if you've had a chance to play with pandas
> inside of Excel. I know Microsoft has added that.
>
> I've yet to try it out (currently, I don't have a computer with Office at
> my fingertips).
>
> Kirby
>
> PS: in my previous post I had a typo buried in the most mathy part, which
> I've since fixed on Github.
> https://groups.io/g/synergeo/message/2481
>
> [1]
> https://www.theatlantic.com/science/archive/2018/04/the-scientific-paper-=
is-obsolete/556676/
> (Atlantic has implemented more of a firewall then previously -- the
> article is about Wolfram's Mathematica as well as Jupyter)
>
> [2]
> https://nbviewer.org/github/4dsolutions/clarusway_data_analysis/blob/main=
/DAwPy_S1_%28Numpy_Arrays%29/daily_schedule.ipynb
>
>
>
> On Thu, Jan 25, 2024 at 1:18=E2=80=AFPM David MacQuigg <[email protected]=
m> wrote:
>
>> Hello Kirby
>>
>> Jupyter is excellent, but I still wish there was a simple built-in
>> charting tool in Python. Jupyter is like Sketchup, a tool I use once a
>> year, but not enough to justify keeping up on it.
>>
>> My work now is focused on nuclear power
>> <https://citizendium.org/wiki/Nuclear_power_reconsidered>, and educating
>> journalists who might break with the mainstream and need a good summary =
of
>> facts and arguments. That occasionally requires me to make a quick
>> calculation and plot, and I find myself using Google Sheets instead of
>> Python. Here is an example on Separative Work Units, the fundamental
>> measure of cost in uranium enrichment. Once you get the calculation work=
ed
>> out, the plot is just a few more clicks.
>>
>> https://docs.google.com/spreadsheets/d/1OyKPyjo6k1ckZVwAh8sfkDEtB5W22VUr=
iBaelK3LWY4/edit?usp=3Dsharing
>>
>> David MacQuigg, PhD
>> Engineering Editor, Citizendium
>> 520-721-4583
>>
>
>
>
> _______________________________________________
> Edu-sig mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/edu-sig.python.org/
> Member address: [email protected]
>
--000000000000dc18b2060fd0612e
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"auto">Notebooks and Spreadsheets often lack test assertions; wh=
ich are critical to quality<div dir=3D"auto"><br></div><div dir=3D"auto">&q=
uot;Spreadsheet errors can have disastrous consequences =E2=80=93 yet we ke=
ep making them" (2024)=C2=A0 <a href=3D"https://news.ycombinator.com/i=
tem?id=3D39132512">https://news.ycombinator.com/item?id=3D39132512</a></div=
><div dir=3D"auto"><br></div><div dir=3D"auto">"""</div><div=
dir=3D"auto">What are some Software Development methods for reducing error=
s:</div><div dir=3D"auto">1. AUTOMATED TESTS; test assertions</div><div dir=
=3D"auto"><br></div><div dir=3D"auto">To write spreadsheet tests:</div><div=
dir=3D"auto"><br></div><div dir=3D"auto">A. Write your own test assertion =
library for their macro language; write assertEqual() in VBscript and Apps =
Script.</div><div dir=3D"auto"><br></div><div dir=3D"auto">B. Use another l=
anguage with a test library and a test runner; e.g. Python and the `assert`=
keyword, unittest.TestCase().assertEqual() or pytest.</div><div dir=3D"aut=
o"><br></div><div dir=3D"auto">C. Test the spreadsheet GUI with something l=
ike AutoHotKey.</div><div dir=3D"auto"><br></div><div dir=3D"auto">From <a =
href=3D"https://news.ycombinator.com/item?id=3D35896192">https://news.ycomb=
inator.com/item?id=3D35896192</a> :</div><div dir=3D"auto"><br></div><div d=
ir=3D"auto">> The Scientific Method is testing, so testing (tests, asser=
tions, fixtures) should be core to any scientific workflow system.</div><di=
v dir=3D"auto"><br></div><div dir=3D"auto">> awesome-jupyter#testing: <a=
href=3D"https://github.com/markusschanta/awesome-jupyter#testing">https://=
github.com/markusschanta/awesome-jupyter#testing</a></div><div dir=3D"auto"=
><br></div><div dir=3D"auto">> ml-tooling/best-of-jupyter lists papermil=
l/papermill under "Interactive Widgets/Visualization" <a href=3D"=
https://github.com/ml-tooling/best-of-jupyter#interactive-wi.">https://gith=
ub.com/ml-tooling/best-of-jupyter#interactive-wi.</a>..</div><div dir=3D"au=
to">"""</div><div dir=3D"auto"><br></div><div dir=3D"auto"><=
br></div><div dir=3D"auto">TIL about K-16:</div><div dir=3D"auto"><br></div=
><div dir=3D"auto">- K12CS: K-12 CS</div><div dir=3D"auto">- Q12: Quantum K=
12</div><div dir=3D"auto">- P-12: Pre-K - 12</div><div dir=3D"auto"><br></d=
iv><div dir=3D"auto">Exercise:</div><div dir=3D"auto"><br></div><div dir=3D=
"auto">- 1. Khanmigo > Tutoring help in Math > ~ask for review questi=
ons in [addition of 3 digit numbers]</div><div dir=3D"auto"><br></div><div =
dir=3D"auto">- 2. Create a notebook in e.g. JupyterLite. This is in the &qu=
ot;percent format" that jupytext and various other IDEs support. `# %%=
` is the input cell delimiter:=C2=A0</div><div dir=3D"auto"><br></div><div =
dir=3D"auto">```python=C2=A0</div><div dir=3D"auto"># %%</div><div dir=3D"a=
uto">321+123</div><div dir=3D"auto"><br></div><div dir=3D"auto"># %%</div><=
div dir=3D"auto">x =3D 321</div><div dir=3D"auto">y =3D 321 + 123</div><div=
dir=3D"auto">print([x, y])</div><div dir=3D"auto"><br></div><div dir=3D"au=
to"># %%</div><div dir=3D"auto">assert 321 + 123 =3D=3D 444</div><div dir=
=3D"auto">assert 444 - 321 =3D=3D 123</div><div dir=3D"auto"><br></div><div=
dir=3D"auto"># %%</div><div dir=3D"auto">import unittest; test =3D unittes=
t.TestCase()</div><div dir=3D"auto">test.assertEqual(321+123, 444)</div><di=
v dir=3D"auto">test.assertEqual(444-321, 123)</div><div dir=3D"auto">test.a=
ssertEqual(444-123, 321)</div><div dir=3D"auto"><br></div><div dir=3D"auto"=
># %%</div><div dir=3D"auto">test_cases =3D [</div><div dir=3D"auto">=C2=A0=
=C2=A0 [1,2,=C2=A0 3],</div><div dir=3D"auto">=C2=A0 =C2=A0 [123, 321, 444=
],</div><div dir=3D"auto">=C2=A0 =C2=A0 [100, 214,=C2=A0 314],</div><div di=
r=3D"auto">=C2=A0 =C2=A0 #[1, 2, 5]</div><div dir=3D"auto">]</div><div dir=
=3D"auto"><br></div><div dir=3D"auto">for a,b,c in test_cases:</div><div di=
r=3D"auto">=C2=A0 =C2=A0 test.assertEqual(a+b, c)</div><div dir=3D"auto">=
=C2=A0 =C2=A0 test.assertEqual(c-b, a)</div><div dir=3D"auto">=C2=A0 =C2=A0=
test.assertEqual(c-a, b)</div><div dir=3D"auto"><br></div><div dir=3D"auto=
"># %%</div><div dir=3D"auto">print([a, b, c])</div><div dir=3D"auto">print=
(f"Hello World: {x} + {y} =3D {z}")</div><div dir=3D"auto">```</d=
iv><div dir=3D"auto"><br></div><div dir=3D"auto"><br></div><div dir=3D"auto=
">; Test assertions for Science</div><div dir=3D"auto"><br></div></div><br>=
<div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Thu, Ja=
n 25, 2024, 7:43=E2=80=AFPM kirby urner <<a href=3D"mailto:kirby.urner@g=
mail.com">[email protected]</a>> wrote:<br></div><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-left:1ex"><div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default=
" style=3D"font-family:verdana,sans-serif;font-size:small"><br></div><div c=
lass=3D"gmail_default" style=3D"font-family:verdana,sans-serif;font-size:sm=
all">Thanks for jumping in David.</div><div class=3D"gmail_default" style=
=3D"font-family:verdana,sans-serif;font-size:small"><br></div><div class=3D=
"gmail_default" style=3D"font-family:verdana,sans-serif;font-size:small">I =
concur, the Excel environment is a productive "home base" for der=
iving the visualizations and is in many cases is sufficient.=C2=A0</div><di=
v class=3D"gmail_default" style=3D"font-family:verdana,sans-serif;font-size=
:small"><br></div><div class=3D"gmail_default" style=3D"font-family:verdana=
,sans-serif;font-size:small">In the Office model, one is then=C2=A0expected=
to embed said visualizations in a Word document, perhaps exporting to PDF,=
if wanting to add more verbiage and/or make it more journal article or tex=
tbook like. [1]</div><div class=3D"gmail_default" style=3D"font-family:verd=
ana,sans-serif;font-size:small"><br></div><div class=3D"gmail_default" styl=
e=3D"font-family:verdana,sans-serif;font-size:small">In your type of advoca=
cy work, maybe getting the visualizations is sufficient, and indeed, the fi=
nal step from Jupyter Notebook to a PDF version is sometimes the trickiest,=
when it comes to page breaks especially.</div><div class=3D"gmail_default"=
style=3D"font-family:verdana,sans-serif;font-size:small"><br></div><div cl=
ass=3D"gmail_default" style=3D"font-family:verdana,sans-serif;font-size:sma=
ll">Here's a Notebook in the same ballpark, dealing with the half life =
of naturally occurring and/or artificially generated radioactive substances=
:</div><div class=3D"gmail_default" style=3D"font-family:verdana,sans-serif=
;font-size:small"><br></div><div class=3D"gmail_default" style=3D"font-fami=
ly:verdana,sans-serif;font-size:small"><a href=3D"https://nbviewer.org/gith=
ub/4dsolutions/School_of_Tomorrow/blob/master/isotope_decay.ipynb" target=
=3D"_blank" rel=3D"noreferrer">https://nbviewer.org/github/4dsolutions/Scho=
ol_of_Tomorrow/blob/master/isotope_decay.ipynb</a><br></div><div class=3D"g=
mail_default" style=3D"font-family:verdana,sans-serif;font-size:small"><br>=
</div><div class=3D"gmail_default" style=3D"font-family:verdana,sans-serif;=
font-size:small">This is the classic synergy of Jupyter=C2=A0+ pandas=C2=A0=
+ matplotlib, the kind of thing I've been teaching through a Turkey-bas=
ed company. [2]</div><div class=3D"gmail_default" style=3D"font-family:verd=
ana,sans-serif;font-size:small"><br></div><div class=3D"gmail_default" styl=
e=3D"font-family:verdana,sans-serif;font-size:small">I don't see it as =
either / or, and true, Jupyter might be the wrong tool in many instances. I=
wonder if you've had a chance to play with pandas inside of Excel. I k=
now Microsoft has added that.=C2=A0</div><div class=3D"gmail_default" style=
=3D"font-family:verdana,sans-serif;font-size:small"><br></div><div class=3D=
"gmail_default" style=3D"font-family:verdana,sans-serif;font-size:small">I&=
#39;ve yet to try it out (currently, I don't have a computer with Offic=
e at my fingertips).</div><div class=3D"gmail_default" style=3D"font-family=
:verdana,sans-serif;font-size:small"><br></div><div class=3D"gmail_default"=
style=3D"font-family:verdana,sans-serif;font-size:small">Kirby</div><div c=
lass=3D"gmail_default" style=3D"font-family:verdana,sans-serif;font-size:sm=
all"><br></div><div class=3D"gmail_default" style=3D"font-family:verdana,sa=
ns-serif;font-size:small">PS: in my previous post I had a typo buried in th=
e most mathy part, which I've since fixed on Github.</div><div class=3D=
"gmail_default" style=3D"font-family:verdana,sans-serif;font-size:small"><a=
href=3D"https://groups.io/g/synergeo/message/2481" target=3D"_blank" rel=
=3D"noreferrer">https://groups.io/g/synergeo/message/2481</a><br></div><div=
class=3D"gmail_default" style=3D"font-family:verdana,sans-serif;font-size:=
small"><br></div><div class=3D"gmail_default" style=3D"font-family:verdana,=
sans-serif;font-size:small">[1]=C2=A0=C2=A0<a href=3D"https://www.theatlant=
ic.com/science/archive/2018/04/the-scientific-paper-is-obsolete/556676/" ta=
rget=3D"_blank" rel=3D"noreferrer">https://www.theatlantic.com/science/arch=
ive/2018/04/the-scientific-paper-is-obsolete/556676/</a></div><div class=3D=
"gmail_default" style=3D"font-family:verdana,sans-serif;font-size:small">(A=
tlantic has implemented more of a firewall then previously -- the article i=
s about Wolfram's Mathematica as well as Jupyter)</div><div class=3D"gm=
ail_default" style=3D"font-family:verdana,sans-serif;font-size:small"><br><=
/div><div class=3D"gmail_default" style=3D"font-family:verdana,sans-serif;f=
ont-size:small">[2]=C2=A0=C2=A0<a href=3D"https://nbviewer.org/github/4dsol=
utions/clarusway_data_analysis/blob/main/DAwPy_S1_%28Numpy_Arrays%29/daily_=
schedule.ipynb" target=3D"_blank" rel=3D"noreferrer">https://nbviewer.org/g=
ithub/4dsolutions/clarusway_data_analysis/blob/main/DAwPy_S1_%28Numpy_Array=
s%29/daily_schedule.ipynb</a></div><div class=3D"gmail_default" style=3D"fo=
nt-family:verdana,sans-serif;font-size:small"><br></div><div class=3D"gmail=
_default" style=3D"font-family:verdana,sans-serif;font-size:small"><br></di=
v></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr=
">On Thu, Jan 25, 2024 at 1:18=E2=80=AFPM David MacQuigg <<a href=3D"mai=
lto:[email protected]" target=3D"_blank" rel=3D"noreferrer">macquigg@gmail=
.com</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1=
ex"><div dir=3D"ltr"><div dir=3D"ltr">Hello Kirby</div><div dir=3D"ltr"><br=
></div><div>Jupyter is excellent, but I still wish there was a simple built=
-in charting tool in Python. Jupyter is like Sketchup, a tool I use once a =
year, but not enough to justify keeping up on it.</div><div><br></div><div>=
My work now is focused on <a href=3D"https://citizendium.org/wiki/Nuclear_p=
ower_reconsidered" target=3D"_blank" rel=3D"noreferrer">nuclear power</a>, =
and educating journalists who might break with the mainstream and need a go=
od summary of facts and arguments. That occasionally requires=C2=A0me to ma=
ke a quick calculation and plot, and I find myself=C2=A0using Google Sheets=
instead of Python. Here is an example on Separative Work Units, the fundam=
ental measure=C2=A0of cost in uranium enrichment. Once you get the calculat=
ion worked out, the plot is just a few more clicks.</div><div><a href=3D"ht=
tps://docs.google.com/spreadsheets/d/1OyKPyjo6k1ckZVwAh8sfkDEtB5W22VUriBael=
K3LWY4/edit?usp=3Dsharing" target=3D"_blank" rel=3D"noreferrer">https://doc=
s.google.com/spreadsheets/d/1OyKPyjo6k1ckZVwAh8sfkDEtB5W22VUriBaelK3LWY4/ed=
it?usp=3Dsharing</a><br></div><div dir=3D"ltr"><br clear=3D"all"><div><div =
dir=3D"ltr" class=3D"gmail_signature"><div dir=3D"ltr">David MacQuigg, PhD<=
/div><div dir=3D"ltr">Engineering Editor, Citizendium<br><div>520-721-4583<=
/div></div></div></div></div></div></blockquote><div><br></div><div><br></d=
iv><div>=C2=A0</div></div></div>
_______________________________________________<br>
Edu-sig mailing list -- <a href=3D"mailto:[email protected]" target=3D"_bl=
ank" rel=3D"noreferrer">[email protected]</a><br>
To unsubscribe send an email to <a href=3D"mailto:[email protected]"=
target=3D"_blank" rel=3D"noreferrer">[email protected]</a><br>
<a href=3D"https://mail.python.org/mailman3/lists/edu-sig.python.org/" rel=
=3D"noreferrer noreferrer" target=3D"_blank">https://mail.python.org/mailma=
n3/lists/edu-sig.python.org/</a><br>
Member address: <a href=3D"mailto:[email protected]" target=3D"_blank" r=
el=3D"noreferrer">[email protected]</a><br>
</blockquote></div>
--000000000000dc18b2060fd0612e--
--===============0754692157443355938==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Edu-sig mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/edu-sig.python.org/
Member address: [email protected]
--===============0754692157443355938==--