[Edu-sig] A Quantum 'Hello World'

2020-04-09 Thread Wes Turner
"Ask HN: What's the Equivalent of 'Hello, World' for a Quantum Computer?"
https://news.ycombinator.com/item?id=22707580
https://westurner.github.io/hnlog/#story-22707580

"Getting Started with Qiskit"
> https://qiskit.org/documentation/getting_started.html
>
> Qiskit / qiskit-community-tutorials > "1 Hello, Quantum World with Qiskit"
> https://github.com/Qiskit/qiskit-community-tutorials#1-hello-quantum-world-with-qiskit
>
> "Quantum basics with Q#"
> https://docs.microsoft.com/en-us/quantum/quickstart?tabs=tabid-python
>
> Qutip notebooks: https://github.com/qutip/qutip#run-notebooks-online
>
> Jupyter Notebooks labeled quantum-computing:
> https://github.com/topics/quantum-computing?l=jupyter+notebook
>

Quantum computing:
https://en.wikipedia.org/wiki/Quantum_computing

Quantum algorithm:
https://en.wikipedia.org/wiki/Quantum_algorithm

Quantum Algorithm Zoo:
https://quantumalgorithmzoo.org

"Quantum Computing for Computer Scientists"
https://www.youtube.com/watch?v=F_Riqjdh2oM
- TIL about classical and quantum logic gates in terms of linear algebra,
matrices, and tensors.
___
Edu-sig mailing list -- edu-sig@python.org
To unsubscribe send an email to edu-sig-le...@python.org
https://mail.python.org/mailman3/lists/edu-sig.python.org/


[Edu-sig] Re: back to school... "1/3" --> float question, just eval?

2020-04-09 Thread Wes Turner
Should've re-read your first message before I replied:

- "CLN: camper_program.py: Cleanup camper program codestyle with black and
pyflakes"
  https://github.com/4dsolutions/python_camp/pull/3
- "TST: camper_program.py: tests and exception handlin"
  https://github.com/4dsolutions/python_camp/pull/4
  - IDK if camper_program_with_tests.py or camper_program_pro.py would be
more or less helpful than just reviewing the (commits in the) PR


https://github.com/4dsolutions/python_camp/blob/master/PyCampNextLevel.ipynb
- Git
  - https://learngitbranching.js.org/ is an excellent interactive resource
for learning git
- Password Hashes
  - argon2 is a chosen cryptographic hash function:
https://en.wikipedia.org/wiki/Argon2
  - Django now defaults to PBKDF2

https://docs.djangoproject.com/en/3.0/topics/auth/passwords/#how-django-stores-passwords
  - https://en.wikipedia.org/wiki/Hashcat is really fast at password hashing
  - Bitcoin has a number of SHA256 implementations; that may be the fastest
int eh whole world
- https://github.com/bitcoin/bitcoin/tree/master/src/crypto
- https://github.com/bitcoin/bitcoin/blob/master/src/crypto/sha256.cpp
- "Dumbcoin - An educational python implementation of a bitcoin-like
blockchain"

https://github.com/julienr/ipynb_playground/blob/master/bitcoin/dumbcoin/dumbcoin.ipynb
- https://en.wikipedia.org/wiki/Hyperledger#Members_and_governance

On Thu, Apr 9, 2020 at 10:30 PM Wes Turner  wrote:

> Are there unit tests for the supported operations?
> Is the UI logic a separate testable unit?
> Does it just fatal exception when parsing fails; or does the REPL loop
> catch the e.g. Value error?
>
> Instead of a CLI eval wrapper with regex, you could use ipywidgets in a
> notebook:
> https://ipywidgets.readthedocs.io/en/latest/examples/Using%20Interact.html
> https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20List.html
>
> You can pair a notebook to a markdown file with jupytext so that the
> notebook autosaves as markdown, which works with mailman 3 mailing list
> archives
>
> On Thu, Apr 9, 2020, 1:44 PM kirby urner  wrote:
>
>>
>>> Try the following:
>>>
>>> from fractions import Fraction
>>> float(Fraction("1/3"))
>>>
>>> Knowing you, I'm sure you can figure out plenty of useful applications
>>> of this. :-)
>>>
>>> André
>>>
>>>
>> A totally excellent suggestion!
>>
>> I'm going to share that, by bringing campers here on tour, saying "this
>> is where Python educators hang out!"
>>
>> Maybe some of them will want to join us someday.
>>
>> Kirby
>>
>>
>> ___
>> Edu-sig mailing list -- edu-sig@python.org
>> To unsubscribe send an email to edu-sig-le...@python.org
>> https://mail.python.org/mailman3/lists/edu-sig.python.org/
>>
>
___
Edu-sig mailing list -- edu-sig@python.org
To unsubscribe send an email to edu-sig-le...@python.org
https://mail.python.org/mailman3/lists/edu-sig.python.org/


[Edu-sig] Re: back to school... "1/3" --> float question, just eval?

2020-04-09 Thread Wes Turner
Are there unit tests for the supported operations?
Is the UI logic a separate testable unit?
Does it just fatal exception when parsing fails; or does the REPL loop
catch the e.g. Value error?

Instead of a CLI eval wrapper with regex, you could use ipywidgets in a
notebook:
https://ipywidgets.readthedocs.io/en/latest/examples/Using%20Interact.html
https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20List.html

You can pair a notebook to a markdown file with jupytext so that the
notebook autosaves as markdown, which works with mailman 3 mailing list
archives

On Thu, Apr 9, 2020, 1:44 PM kirby urner  wrote:

>
>> Try the following:
>>
>> from fractions import Fraction
>> float(Fraction("1/3"))
>>
>> Knowing you, I'm sure you can figure out plenty of useful applications of
>> this. :-)
>>
>> André
>>
>>
> A totally excellent suggestion!
>
> I'm going to share that, by bringing campers here on tour, saying "this is
> where Python educators hang out!"
>
> Maybe some of them will want to join us someday.
>
> Kirby
>
>
> ___
> Edu-sig mailing list -- edu-sig@python.org
> To unsubscribe send an email to edu-sig-le...@python.org
> https://mail.python.org/mailman3/lists/edu-sig.python.org/
>
___
Edu-sig mailing list -- edu-sig@python.org
To unsubscribe send an email to edu-sig-le...@python.org
https://mail.python.org/mailman3/lists/edu-sig.python.org/


[Edu-sig] Re: back to school... "1/3" --> float question, just eval?

2020-04-09 Thread kirby urner
>
>
> Try the following:
>
> from fractions import Fraction
> float(Fraction("1/3"))
>
> Knowing you, I'm sure you can figure out plenty of useful applications of
> this. :-)
>
> André
>
>
A totally excellent suggestion!

I'm going to share that, by bringing campers here on tour, saying "this is
where Python educators hang out!"

Maybe some of them will want to join us someday.

Kirby
___
Edu-sig mailing list -- edu-sig@python.org
To unsubscribe send an email to edu-sig-le...@python.org
https://mail.python.org/mailman3/lists/edu-sig.python.org/


[Edu-sig] Re: back to school... "1/3" --> float question, just eval?

2020-04-09 Thread André Roberge
On Thu, Apr 9, 2020 at 2:02 PM kirby urner  wrote:

> Here's a thread I'm starting with my campers taking a PyCamp course.
>
> Yesterday we were co-evolving a calculator driven by looping menu.  It
> does squares and square roots (one of the campers supplied this logic) and
> I was just getting around to introducing the y^x key as some call it, i.e.
> any number to any power, Python's pow(num, exp).
>
> Today we'll pick up where we left off.
>
> We used the shared whiteboard to draw radical signs as I intoned about how
> pow(3, 3) means like ```3 * 3 * 3```.  Math Adventures in Python.  We might
> also say ```3 ** 3``` (and not ```3^3``` like in so many languages).
> sqrt(num) is the same as ```num ** (1/2)``` and we can get the 3rd root of
> 27 with ```27 ** (1/3)```.
>
> [ Sorry for all the markdown by the way, if you're getting a plaintext
> version -- an option I'd advocate for browser based viewers of the archives
> someday (to see what it looked like way back when, Before Markdown). ]
>
> So here's what we're up against:  say I want to raise 10 to the 1/3rd
> power, same as taking a "cube root" of 10 (tetrahedral whatever).  The menu
> prompts:
>
> ```python
>
> num = float(input("Your number please: > "))  # yes a bit dangerous
> exp = float(input("...and your exponent: > "))  #  user wants to do 1/3
> ```
>
> Of course that last statement raises an exception because float("1/3")
> doesn't work (isn't supposed to). What shall we do then?
>


Try the following:

from fractions import Fraction
float(Fraction("1/3"))

Knowing you, I'm sure you can figure out plenty of useful applications of
this. :-)

André



>
> I'm thinking we parse anything that looks like a legal fraction and do the
> floating point conversion from int(p)/int(q).  We won't allow input like
> 2.1/3.6 just int/int.  I've already preached against eval() but if it
> passes my regular expression test first...
>
> Anyway, it's a discussion.  These are like middle schoolers previewing
> high school, at a time when kid focused code schools were under some
> pressure to convert to "everything online".  I used to drive to the schools.
>
> We don't have to use a regexp!  A good excuse to say what these are
> though.  Or test for the pattern but then use split("/") to pry numerator
> from denominator, once we know that'll work?
>
> https://github.com/4dsolutions/python_camp/blob/master/camper_program.py
> (snapshot -- part of the camp is they watch me git pushing updates to the
> camp repo).
>
> Rather perversely, I may set things back between camps i.e. I'll
> deliberately revert the code.
>
> Comments?  Code?
>
> Kirby
>
> PS:  I notice Python 3.8 is being rather more generous in its statistics
> module. Campers who wander from the base camp fire are likely to find
> themselves staring at pdfs and cdfs.
> ___
> Edu-sig mailing list -- edu-sig@python.org
> To unsubscribe send an email to edu-sig-le...@python.org
> https://mail.python.org/mailman3/lists/edu-sig.python.org/
>
___
Edu-sig mailing list -- edu-sig@python.org
To unsubscribe send an email to edu-sig-le...@python.org
https://mail.python.org/mailman3/lists/edu-sig.python.org/


[Edu-sig] back to school... "1/3" --> float question, just eval?

2020-04-09 Thread kirby urner
Here's a thread I'm starting with my campers taking a PyCamp course.

Yesterday we were co-evolving a calculator driven by looping menu.  It does
squares and square roots (one of the campers supplied this logic) and I was
just getting around to introducing the y^x key as some call it, i.e. any
number to any power, Python's pow(num, exp).

Today we'll pick up where we left off.

We used the shared whiteboard to draw radical signs as I intoned about how
pow(3, 3) means like ```3 * 3 * 3```.  Math Adventures in Python.  We might
also say ```3 ** 3``` (and not ```3^3``` like in so many languages).
sqrt(num) is the same as ```num ** (1/2)``` and we can get the 3rd root of
27 with ```27 ** (1/3)```.

[ Sorry for all the markdown by the way, if you're getting a plaintext
version -- an option I'd advocate for browser based viewers of the archives
someday (to see what it looked like way back when, Before Markdown). ]

So here's what we're up against:  say I want to raise 10 to the 1/3rd
power, same as taking a "cube root" of 10 (tetrahedral whatever).  The menu
prompts:

```python

num = float(input("Your number please: > "))  # yes a bit dangerous
exp = float(input("...and your exponent: > "))  #  user wants to do 1/3
```

Of course that last statement raises an exception because float("1/3")
doesn't work (isn't supposed to). What shall we do then?

I'm thinking we parse anything that looks like a legal fraction and do the
floating point conversion from int(p)/int(q).  We won't allow input like
2.1/3.6 just int/int.  I've already preached against eval() but if it
passes my regular expression test first...

Anyway, it's a discussion.  These are like middle schoolers previewing high
school, at a time when kid focused code schools were under some pressure to
convert to "everything online".  I used to drive to the schools.

We don't have to use a regexp!  A good excuse to say what these are
though.  Or test for the pattern but then use split("/") to pry numerator
from denominator, once we know that'll work?

https://github.com/4dsolutions/python_camp/blob/master/camper_program.py
(snapshot -- part of the camp is they watch me git pushing updates to the
camp repo).

Rather perversely, I may set things back between camps i.e. I'll
deliberately revert the code.

Comments?  Code?

Kirby

PS:  I notice Python 3.8 is being rather more generous in its statistics
module. Campers who wander from the base camp fire are likely to find
themselves staring at pdfs and cdfs.
___
Edu-sig mailing list -- edu-sig@python.org
To unsubscribe send an email to edu-sig-le...@python.org
https://mail.python.org/mailman3/lists/edu-sig.python.org/