February 26, 2019

1212 words 6 mins read

norvig/pytudes

norvig/pytudes

Python programs to practice or demonstrate skills.

repo name norvig/pytudes
repo link https://github.com/norvig/pytudes
homepage
language Jupyter Notebook
size (curr.) 26339 kB
stars (curr.) 13479
created 2017-03-01
license MIT License

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

This project contains pytudes—Python programs, usually short, for perfecting programming skills.

Some are in Jupyter (IPython) notebooks, some in .py files. You can view the files here on github, or click the NB link to view them on nbviewer (which sometimes works better). If you want to run the notebooks, not just view them, you can clone the project, or run all the notebooks online by clicking this button: Binder, or click the DN link to run each individual notebook on deepnote.

Index of Jupyter (IPython) Notebooks

Programming Examples
Advent of Code 2018    NB, DNPuzzle site with a coding puzzle each day for Advent 2018 .
Advent of Code 2017    NB, DNPuzzle site with a coding puzzle each day for Advent 2017.
Advent of Code 2016    NB, DNPuzzle site with a coding puzzle each day for Advent 2016.
Project Euler Utilities    NB, DNMy utility functions for the Project Euler problems, including Primes and Factors.
Translating English Sentences into Propositional Logic Statements    NB, DNAutomatically converting informal English sentences into formal Propositional Logic.
Beal’s Conjecture Revisited    NB, DNA search for counterexamples to Beal’s Conjecture
WWW: Who Will Win (NBA Title)?    NB, DNComputing the probability of winning the NBA title, for my home town Warriors, or any other team.
Pickleball Tournament    NB, DNScheduling a doubles tournament fairly and efficiently.
Dice Baseball    NB, DNSimulating baseball games.
Conway’s Game of Life    NB, DNThe cellular automata zero-player game.
A Chaos Game with Triangles    NB, DNA surprising appearance of the Sierpinski triangle in a random walk between vertexes.
Generating Mazes    NB, DNMake a maze by generating a random tree superimposed on a grid.
Weighing Twelve Balls    NB, DNA 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.
Can’t Stop    NB, DNOptimal play in a dice board game.
Bike Speed Versus Grade    NB, DNHow fast can I bike as the route gets steeper?
Properly Ordered Card Hands    NB, DNCan you get your hand of cards into a nice order with just one move?
Tracking Trump: Electoral Votes    NB, DNHow many electoral votes would Trump get if he wins the state where he has positive net approval?
Logic and Number Puzzles
When is Cheryl’s Birthday?    NB, DNSolving the “Cheryl’s Birthday” logic puzzle.
When Cheryl Met Eve: A Birthday Story    NB, DNInventing new puzzles in the Style of Cheryl’s Birthday.
Riddler Lottery NB, DNCan you find what lottery number tickets these five friends picked?
How Many Soldiers Do You Need to Beat the Night King? NB, DNInvestigasting a battle between the army of the dead and the army of the living.
The Devil and the Coin Flip Game    NB, DNHow to beat the Devil at his own game.
The Puzzle of the Misanthropic Neighbors    NB, DNHow crowded will this neighborhood be, if nobody wants to live next door to anyone else?
Four 4s, Five 5s, and Countdown to 2016    NB, DNSolving the equation 10 _ 9 _ 8 _ 7 _ 6 _ 5 _ 4 _ 3 _ 2 _ 1 = 2016. From an Alex Bellos puzzle.
Sicherman Dice    NB, DNFind a pair of dice that is like a regular pair of dice, only different.
Sol Golomb’s Rectangle Puzzle    NB, DNA Puzzle involving placing rectangles of different sizes inside a square.
Cryptarithmetic    NB, DNSubstitute digits for letters and make NUM + BER = PLAY.
The Riddler: Battle Royale    NB, DNA puzzle involving allocating your troops and going up against an opponent.
Word Games
Spelling Bee    NB, DNFind the highest-scoring board for the NY Times Spelling Bee puzzle.
Boggle / Inverse Boggle    NB, DNFind all the words on a Boggle board; then find a board with a lot of words.
Portmantout Words NB, DNFind a long word that squishes together a bunch of words.
xkcd 1970: Name Dominoes    NB, DNLay out dominoes legally; the dominoes have people names, not numbers.
Ghost    NB, DNThe word game Ghost (add letters, try to avoid making a word).
World’s Longest Palindrome    NB, DNSearching for a long Panama-style palindrome, this time letter-by-letter.
Refactoring a Crossword Game Program    NB, DNRefactoring the Scrabble / Word with Friends game from Udacity 212.
xkcd 1313: Regex Golf    NB, DNFind the smallest regular expression; inspired by Randall Monroe.
xkcd 1313: Regex Golf (Part 2: Infinite Problems)    NB, DNRegex Golf: better, faster, funner. With Stefan Pochmann.
Let’s Code About Bike Locks    NB, DNA tale of a bicycle combination lock that uses letters instead of digits. Inspired by Bike Snob NYC.
Gesture Typing    NB, DNWhat word has the longest path on a gesture-typing smartphone keyboard?
How to Do Things with Words, or Statistical Natural Language Processing in Python    NB, DNSpelling Correction, Secret Codes, Word Segmentation, and more: grab your bag of words.
Math Concepts
A Concrete Introduction to Probability    NB, DNCode and examples of the basic principles of Probability Theory.
Probability, Paradox, and the Reasonable Person Principle    NB, DNSome classic paradoxes in Probability Theory, and how to think about disagreements.
Estimating Probabilities with Simulations    NB, DNWhen the sample space is too complex, simulations can estimate probabilities.
Symbolic Algebra, Simplification, and Differentiation    NB, DNA computer algebra system that manipulates expressions, including symbolic differentiation.
Economics Simulation    NB, DNA simulation of a simple economic game.
How to Count Things    NB, DNCombinatorial math: how to count how many things there are, when there are a lot of them.
Pairing Socks    NB, DNWhat is the probability that you will be able to pair up socks as you randomly pull them out of the dryer?
Euler’s Sum of Powers Conjecture    NB, DNSolving a 200-year-old puzzle by finding integers that satisfy a5 + b5 + c5 + d5 = e5.
Computer Science Algorithms and Concepts
BASIC Interpreter    NB, DNHow to write an interpreter for the BASIC programming language.
Bad Grade, Good Experience    NB, DNAs a student, did you ever get a bad grade on a programming assignment? (Snobol, Concordance)
The Convex Hull Problem    NB, DNA classic Computer Science Algorithm.
The Traveling Salesperson Problem    NB, DNAnother of the classics.

Index of Python Files

File Description Documentation
SET.py Analyze the card game SET. SET.html
beal.py Search for counterexamples to Beal’s Conjecture beal.html
docex.py A framework for running unit tests, similar to doctest.
ibol.py An Exercise in Species Barcoding ibol.html
lettercount.py Convert Google Ngram Counts to Letter Counts mayzner.html
lis.py Lisp Interpreter written in Python lispy.html
lispy.py Even Better Lisp Interpreter written in Python lispy2.html
lispytest.py Tests for Lisp Interpreters
pal.py Find long palindromes palindrome.html
pal2.py Find longer palindromes palindrome.html
pal3.py Find even longer palindromes palindrome.html
py2html.py Pretty-printer to format Python files as html
spell.py Spelling corrector spell-correct.html
sudoku.py Program to solve sudoku puzzles sudoku.html
testaccum.py Tests for my failed Python accumulation display proposal pyacc.html
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 by Charles Wetherell that was very influential to me when I was first learning to program.

comments powered by Disqus