115 lines
31 KiB
Markdown
115 lines
31 KiB
Markdown
|
|
# pytudes
|
|
|
|
"An *étude* (a French word meaning *study*) is an instrumental musical composition, usually short, of considerable difficulty, and designed to provide practice material for perfecting a particular musical skill." — [Wikipedia](https://en.wikipedia.org/wiki/%C3%89tude)
|
|
|
|
This project contains **pytudes**—Python programs, usually short, for perfecting programming skills.
|
|
|
|
Some programs are in Jupyter (`.ipynb`) notebooks, some in `.py` files. For each notebook you can click on:
|
|
- [CO](https://colab.research.google.com) to **run** the file on Colab
|
|
- [DN](https://deepnote.com) to **run** the notebook on DeepNote
|
|
- [MY](https://mybinder.org) to **run** the notebook on MyBinder
|
|
- [NB](https://nbviewer.jupyter.org/) to **view** the notebook on NBViewer
|
|
- **The title** to **view** the notebook on github, and **download** or **fork** it.
|
|
|
|
# Index of Jupyter (IPython) Notebooks
|
|
|
|
|Run|Programming Examples|
|
|
|---|--|
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Advent-2018.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FAdvent-2018.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Advent-2018.ipynb) | <b><a href="ipynb/Advent-2018.ipynb" title="Puzzle site with a coding puzzle each day for Advent 2018 ">Advent of Code 2018</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Advent%202017.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FAdvent%202017.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Advent%202017.ipynb) | <b><a href="ipynb/Advent%202017.ipynb" title="Puzzle site with a coding puzzle each day for Advent 2017">Advent of Code 2017</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Advent%20of%20Code.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FAdvent%20of%20Code.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Advent%20of%20Code.ipynb) | <b><a href="ipynb/Advent%20of%20Code.ipynb" title="Puzzle site with a coding puzzle each day for Advent 2016*">Advent of Code 2016</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Project%20Euler%20Utils.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FProject%20Euler%20Utils.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Project%20Euler%20Utils.ipynb) | <b><a href="ipynb/Project%20Euler%20Utils.ipynb" title="My utility functions for the Project Euler problems, including `Primes` and `Factors`">Project Euler Utilities</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/PropositionalLogic.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FPropositionalLogic.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/PropositionalLogic.ipynb) | <b><a href="ipynb/PropositionalLogic.ipynb" title="Automatically converting informal English sentences into formal Propositional Logic">Translating English Sentences into Propositional Logic Statements</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Beal.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FBeal.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Beal.ipynb) | <b><a href="ipynb/Beal.ipynb" title="A search for counterexamples to Beal's Conjecture">Beal's Conjecture Revisited</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/WWW.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FWWW.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/WWW.ipynb) | <b><a href="ipynb/WWW.ipynb" title="Computing the probability of winning the NBA title, for my home town Warriors, or any other team">WWW: Who Will Win (NBA Title)?</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Pickleball.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FPickleball.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Pickleball.ipynb) | <b><a href="ipynb/Pickleball.ipynb" title="Scheduling a doubles tournament fairly and efficiently">Pickleball Tournament</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Dice%20Baseball.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FDice%20Baseball.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Dice%20Baseball.ipynb) | <b><a href="ipynb/Dice%20Baseball.ipynb" title="Simulating baseball games">Dice Baseball</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Life.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FLife.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Life.ipynb) | <b><a href="ipynb/Life.ipynb" title="The cellular automata zero-player game">Conway's Game of Life</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Sierpinski.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FSierpinski.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Sierpinski.ipynb) | <b><a href="ipynb/Sierpinski.ipynb" title="A surprising appearance of the Sierpinski triangle in a random walk between vertexes">A Chaos Game with Triangles</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Maze.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FMaze.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Maze.ipynb) | <b><a href="ipynb/Maze.ipynb" title="Make a maze by generating a random tree superimposed on a grid">Generating Mazes</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/TwelveBalls.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FTwelveBalls.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/TwelveBalls.ipynb) | <b><a href="ipynb/TwelveBalls.ipynb" title="A puzzle where you are given some billiard balls and a balance scale, and asked to find the one ball that is heavier or lighter, in a limited number of weighings">Weighing Twelve Balls</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Cant-Stop.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FCant-Stop.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Cant-Stop.ipynb) | <b><a href="ipynb/Cant-Stop.ipynb" title="Optimal play in a dice board game">Can't Stop</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Bike%20Speed%20versus%20Grade.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FBike%20Speed%20versus%20Grade.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Bike%20Speed%20versus%20Grade.ipynb) | <b><a href="ipynb/Bike%20Speed%20versus%20Grade.ipynb" title="How fast can I bike as the route gets steeper?">Bike Speed Versus Grade</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Orderable%20Cards.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FOrderable%20Cards.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Orderable%20Cards.ipynb) | <b><a href="ipynb/Orderable%20Cards.ipynb" title="Can you get your hand of cards into a nice order with just one move?">Properly Ordered Card Hands</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Electoral%20Votes.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FElectoral%20Votes.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Electoral%20Votes.ipynb) | <b><a href="ipynb/Electoral%20Votes.ipynb" title="How many electoral votes would Trump get if he wins the state where he has positive net approval?">Tracking Trump: Electoral Votes</a></b> |
|
|
|
|
|Logic and Number Puzzles|
|
|
|--|---|
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Cheryl.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FCheryl.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Cheryl.ipynb) | <b><a href="ipynb/Cheryl.ipynb" title="Solving the "Cheryl's Birthday" logic puzzle">When is Cheryl's Birthday?</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Cheryl-and-Eve.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FCheryl-and-Eve.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Cheryl-and-Eve.ipynb) | <b><a href="ipynb/Cheryl-and-Eve.ipynb" title="Inventing new puzzles in the Style of Cheryl's Birthday">When Cheryl Met Eve: A Birthday Story</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/RiddlerLottery.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FRiddlerLottery.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/RiddlerLottery.ipynb) | <b><a href="ipynb/RiddlerLottery.ipynb" title="Can you find what lottery number tickets these five friends picked?">Riddler Lottery</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/NightKing.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FNightKing.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/NightKing.ipynb) | <b><a href="ipynb/NightKing.ipynb" title="Investigasting a battle between the army of the dead and the army of the living">How Many Soldiers Do You Need to Beat the Night King?</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Coin%20Flip.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FCoin%20Flip.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Coin%20Flip.ipynb) | <b><a href="ipynb/Coin%20Flip.ipynb" title="How to beat the Devil at his own game">The Devil and the Coin Flip Game</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Mean%20Misanthrope%20Density.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FMean%20Misanthrope%20Density.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Mean%20Misanthrope%20Density.ipynb) | <b><a href="ipynb/Mean%20Misanthrope%20Density.ipynb" title="How crowded will this neighborhood be, if nobody wants to live next door to anyone else?">The Puzzle of the Misanthropic Neighbors</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Countdown.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FCountdown.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Countdown.ipynb) | <b><a href="ipynb/Countdown.ipynb" title="Solving the equation 10 _ 9 _ 8 _ 7 _ 6 _ 5 _ 4 _ 3 _ 2 _ 1 = 2016. From an Alex Bellos puzzle">Four 4s, Five 5s, and Countdown to 2016</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Sicherman%20Dice.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FSicherman%20Dice.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Sicherman%20Dice.ipynb) | <b><a href="ipynb/Sicherman%20Dice.ipynb" title="Find a pair of dice that is like a regular pair of dice, only different">Sicherman Dice</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Golomb-Puzzle.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FGolomb-Puzzle.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Golomb-Puzzle.ipynb) | <b><a href="ipynb/Golomb-Puzzle.ipynb" title="A Puzzle involving placing rectangles of different sizes inside a square">Sol Golomb's Rectangle Puzzle</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Cryptarithmetic.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FCryptarithmetic.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Cryptarithmetic.ipynb) | <b><a href="ipynb/Cryptarithmetic.ipynb" title="Substitute digits for letters and make NUM + BER = PLAY">Cryptarithmetic</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Riddler%20Battle%20Royale.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FRiddler%20Battle%20Royale.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Riddler%20Battle%20Royale.ipynb) | <b><a href="ipynb/Riddler%20Battle%20Royale.ipynb" title="A puzzle involving allocating your troops and going up against an opponent">The Riddler: Battle Royale</a></b> |
|
|
|
|
|Run|Word Games|
|
|
|---|--|
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/SpellingBee.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FSpellingBee.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/SpellingBee.ipynb) | <b><a href="ipynb/SpellingBee.ipynb" title="Find the highest-scoring board for the NY Times Spelling Bee puzzle">Spelling Bee</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/ElementSpelling.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FElementSpelling.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/ElementSpelling.ipynb) | <b><a href="ipynb/ElementSpelling.ipynb" title="">Chemical Element Spelling</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Boggle.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FBoggle.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Boggle.ipynb) | <b><a href="ipynb/Boggle.ipynb" title="Find all the words on a Boggle board; then find a board with a lot of words">Boggle / Inverse Boggle</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Portmantout.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FPortmantout.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Portmantout.ipynb) | <b><a href="ipynb/Portmantout.ipynb" title="Find a long word that squishes together a bunch of words">Portmantout Words</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/xkcd-Name-Dominoes.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fxkcd-Name-Dominoes.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/xkcd-Name-Dominoes.ipynb) | <b><a href="ipynb/xkcd-Name-Dominoes.ipynb" title="Lay out dominoes legally; the dominoes have people names, not numbers">xkcd 1970: Name Dominoes</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Ghost.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FGhost.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Ghost.ipynb) | <b><a href="ipynb/Ghost.ipynb" title="The word game Ghost (add letters, try to avoid making a word)">Ghost</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/pal3.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fpal3.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/pal3.ipynb) | <b><a href="ipynb/pal3.ipynb" title="Searching for a long Panama-style palindrome, this time letter-by-letter">World's Longest Palindrome</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Scrabble.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FScrabble.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Scrabble.ipynb) | <b><a href="ipynb/Scrabble.ipynb" title="Refactoring the Scrabble / Word with Friends game from Udacity 212">Refactoring a Crossword Game Program</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/xkcd1313.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fxkcd1313.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/xkcd1313.ipynb) | <b><a href="ipynb/xkcd1313.ipynb" title="Find the smallest regular expression; inspired by Randall Monroe">xkcd 1313: Regex Golf</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/xkcd1313-part2.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2Fxkcd1313-part2.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/xkcd1313-part2.ipynb) | <b><a href="ipynb/xkcd1313-part2.ipynb" title="Regex Golf: better, faster, funner. With Stefan Pochmann">xkcd 1313: Regex Golf (Part 2: Infinite Problems)</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Fred%20Buns.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FFred%20Buns.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Fred%20Buns.ipynb) | <b><a href="ipynb/Fred%20Buns.ipynb" title="A tale of a bicycle combination lock that uses letters instead of digits. Inspired by Bike Snob NYC">Let's Code About Bike Locks</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Gesture%20Typing.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FGesture%20Typing.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Gesture%20Typing.ipynb) | <b><a href="ipynb/Gesture%20Typing.ipynb" title="What word has the longest path on a gesture-typing smartphone keyboard?">Gesture Typing</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/How%20to%20Do%20Things%20with%20Words.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FHow%20to%20Do%20Things%20with%20Words.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/How%20to%20Do%20Things%20with%20Words.ipynb) | <b><a href="ipynb/How%20to%20Do%20Things%20with%20Words.ipynb" title="Spelling Correction, Secret Codes, Word Segmentation, and more: grab your bag of words">How to Do Things with Words, or Statistical Natural Language Processing in Python</a></b> |
|
|
|
|
|Run|Math Concepts|
|
|
|--|--|
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Probability.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FProbability.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Probability.ipynb) | <b><a href="ipynb/Probability.ipynb" title="Code and examples of the basic principles of Probability Theory">A Concrete Introduction to Probability</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/ProbabilityParadox.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FProbabilityParadox.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/ProbabilityParadox.ipynb) | <b><a href="ipynb/ProbabilityParadox.ipynb" title="Some classic paradoxes in Probability Theory, and how to think about disagreements">Probability, Paradox, and the Reasonable Person Principle</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/ProbabilitySimulation.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FProbabilitySimulation.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/ProbabilitySimulation.ipynb) | <b><a href="ipynb/ProbabilitySimulation.ipynb" title="When the sample space is too complex, simulations can estimate probabilities">Estimating Probabilities with Simulations</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Differentiation.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FDifferentiation.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Differentiation.ipynb) | <b><a href="ipynb/Differentiation.ipynb" title="A computer algebra system that manipulates expressions, including symbolic differentiation">Symbolic Algebra, Simplification, and Differentiation</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Economics.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FEconomics.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Economics.ipynb) | <b><a href="ipynb/Economics.ipynb" title="A simulation of a simple economic game">Economics Simulation</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/How%20To%20Count%20Things.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FHow%20To%20Count%20Things.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/How%20To%20Count%20Things.ipynb) | <b><a href="ipynb/How%20To%20Count%20Things.ipynb" title="Combinatorial math: how to count how many things there are, when there are a lot of them">How to Count Things</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Socks.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FSocks.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Socks.ipynb) | <b><a href="ipynb/Socks.ipynb" title="What is the probability that you will be able to pair up socks as you randomly pull them out of the dryer?">Pairing Socks</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Euler's%20Conjecture.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FEuler's%20Conjecture.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Euler's%20Conjecture.ipynb) | <b><a href="ipynb/Euler's%20Conjecture.ipynb" title="Solving a 200-year-old puzzle by finding integers that satisfy a<sup>5</sup> + b<sup>5</sup> + c<sup>5</sup> + d<sup>5</sup> = e<sup>5</sup>">Euler's Sum of Powers Conjecture</a></b> |
|
|
|
|
|Run|Computer Science Algorithms and Concepts|
|
|
|--|--|
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Convex%20Hull.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FConvex%20Hull.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Convex%20Hull.ipynb) | <b><a href="ipynb/Convex%20Hull.ipynb" title="A classic Computer Science Algorithm">The Convex Hull Problem</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/TSP.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FTSP.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/TSP.ipynb) | <b><a href="ipynb/TSP.ipynb" title="Another of the classics">The Traveling Salesperson Problem</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/StableMatching.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FStableMatching.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/StableMatching.ipynb) | <b><a href="ipynb/StableMatching.ipynb" title="">The Stable Matching Problem</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/BASIC.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FBASIC.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/BASIC.ipynb) | <b><a href="ipynb/BASIC.ipynb" title="How to write an interpreter for the BASIC programming language">BASIC Interpreter</a></b> |
|
|
| [CO](https://colab.research.google.com/github/googlecolab/colabtools/Snobol.ipynb) [DN](https://beta.deepnote.org/launch?template=python_3.6&url=https%3A%2F%2Fgithub.com%2Fnorvig%2Fpytudes%2FSnobol.ipynb) [MY](https://mybinder.org/v2/gh/norvig/pytudes/master) [NB](https://nbviewer.jupyter.org/github/norvig/pytudes//blob/master/ipynb/Snobol.ipynb) | <b><a href="ipynb/Snobol.ipynb" title="As a student, did you ever get a bad grade on a programming assignment? (Snobol, Concordance)">Bad Grade, Good Experience</a></b> |
|
|
|
|
# Index of Python Files
|
|
|
|
| **File** | **Description** | **Documentation**|
|
|
|:--------|:-------------------|----|
|
|
|[SET.py](/blob/master/py/SET.py)|*Analyze the card game SET*|[documentation](http://norvig.com/SET.html)|
|
|
|[beal.py](/blob/master/py/beal.py)|*Search for counterexamples to Beal's Conjecture*|[documentation](http://norvig.com/beal.html)|
|
|
|[docex.py](/blob/master/py/docex.py)|*A framework for running unit tests, similar to `doctest`*||
|
|
|[ibol.py](/blob/master/py/ibol.py)|*An Exercise in Species Barcoding*|[documentation](http://norvig.com/ibol.html)|
|
|
|[lettercount.py](/blob/master/py/lettercount.py)|*Convert Google Ngram Counts to Letter Counts*|[documentation](http://norvig.com/mayzner.html)|
|
|
|[lis.py](/blob/master/py/lis.py)|*Lisp Interpreter written in Python*|[documentation](http://norvig.com/lispy.html)|
|
|
|[lispy.py](/blob/master/py/lispy.py)|*Even Better Lisp Interpreter written in Python*|[documentation](http://norvig.com/lispy2.html)|
|
|
|[lispytest.py](/blob/master/py/lispytest.py)|*Tests for Lisp Interpreters*||
|
|
|[pal.py](/blob/master/py/pal.py)|*Find long palindromes*|[documentation](http://norvig.com/palindrome.html)|
|
|
|[pal2.py](/blob/master/py/pal2.py)|*Find longer palindromes*|[documentation](http://norvig.com/palindrome.html)|
|
|
|[pal3.py](/blob/master/py/pal3.py)|*Find even longer palindromes*|[documentation](http://norvig.com/palindrome.html)|
|
|
|[py2html.py](/blob/master/py/py2html.py)|*Pretty-printer to format Python files as html*||
|
|
|[spell.py](/blob/master/py/spell.py)|*Spelling corrector*|[documentation](http://norvig.com/spell-correct.html)|
|
|
|[sudoku.py](/blob/master/py/sudoku.py)|*Program to solve sudoku puzzles*|[documentation](http://norvig.com/sudoku.html)|
|
|
|[testaccum.py](/blob/master/py/testaccum.py)|*Tests for my failed Python `accumulation display` proposal*|[documentation](http://norvig.com/pyacc.html)|
|
|
|[yaptu.py](/blob/master/py/yaptu.py)|*Yet Another Python Templating Utility*||
|
|
|
|
# Etudes for Programmers
|
|
|
|
I got the idea for the *"etudes"* part of the name from
|
|
this [1978 book](https://books.google.com/books/about/Etudes_for_programmers.html?id=u89WAAAAMAAJ)
|
|
by [Charles Wetherell](http://demin.ws/blog/english/2012/08/25/interview-with-charles-wetherell)
|
|
that was very influential to me when I was first learning to program.
|
|
|
|

|