[Edu-sig] learning Unicode through Jupyter (with Python)

kirby urner kirby.urner at gmail.com
Mon Oct 29 18:16:38 EDT 2018


Since full unicode is the current range of the default string type (str), I
find my initial explorations of strings often swerve into chess pieces,
playing cards, emoji.

Speaking of playing cards: I'm surprised to discover an unfamiliar face
card this late in life.  Unicode has a "Knight" (letter C) in all four
suits.  I'm so used to Bicycle decks with suits of 13.  I chop out all the
Knights using slice notation in the Notebook linked below.

The playing card motif is especially apropos around Python given the logo
has that face card symmetry, if you know what I mean.  I believe Luciano
Ramahlo does playing cards quite a bit, along with little flag GIFs (served
by nginx), which I think these days could be emoji.

If not bothering with Unicode, then why not just:

from random import shuffle

suits = "Hearts Clubs Spades Diamonds".split() # chop me up
royals = "Ace Jack Queen King".split() # could Ace be a she?  Sure!
normals = [str(i) for i in range(2, 11)] # starts at 1, stops at 10

deck = [ ]  # I'm an empty list

for s in suits:  # outer loop
    for n in [royals[0]] + normals + royals[1:]: # Ace, normals, rest
        card = (n, s)           # (suit, face value)
        deck.append(card)

deck += ["Joker", "Joker"]      # need these too!
print("Fresh from box:\n", deck)
shuffle(deck)
print("Shuffled:\n", deck)

But then we'd probably want instances of the Deck class no?  Self
shuffling.

Besides, I think bothering with Unicode is worth the effort.

Lets not lazily pretend we still live in the days of ASCII.

Copying over from a publicly shared Jupyter listserv, one of mine from
yesterday:

===

"Orthogonal" to the programming languages (yet pops up in most of them):
 Unicode.

http://nbviewer.jupyter.org/github/4dsolutions/SAISOFT/blob/master/Unicode_Fun.ipynb

I'm finding Jupyter fun for exploring Unicode, in part because of HTML( )
enlargement possibility.

I approach it through Python, but other kernels could do that too.

I second Lee's enthusiasm for the Jake Vanderplas tutorials.

He gave a great keynote at a Pycon I went to here in Portland.
Kirby


On Sun, Oct 28, 2018 at 8:19 PM Lee Smith <leesmith404 at gmail.com> wrote:

>
>
> On Wednesday, October 17, 2018 at 7:30:53 AM UTC-7, akash deep srivastava
> wrote:
>>
>> hi i am akash i'am student of today i'am staring a jupyter . i dont know
>> what is jupyter and what is the use so please help me and guide to jupyter .
>>
>
> Jupyter is a Browser that easily allows programming experiments.  First in
> Python, now there are C++ kernels being adopted.   You will find Juyper
> very useful since on line a number of people are publishing free courses
> written in a notebook.  Consider https://github.com/jakevdp.    One of
> his 'Repitories'  -- folders is a complete elementary course in Python.  "
> WhirlwindTourOfPython <https://github.com/jakevdp/WhirlwindTourOfPython>"
>
>
>
 ===
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/edu-sig/attachments/20181029/f8d47b7c/attachment.html>


More information about the Edu-sig mailing list