back to home

norvig / pytudes

Python programs, usually short, of considerable difficulty, to perfect particular skills.

24,289 stars
2,494 forks
32 issues
Jupyter NotebookHTMLPython

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing norvig/pytudes in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/norvig/pytudes)
Preview:Analyzed by RepoMind

Repository Summary (README)

Preview
Peter Norvig
MIT License
2015-2022

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 particular programming skills.

Who is this for?

To continue the musical analogy, some people think of programming like Spotify: they want to know how to install the app, find a good playlist, and hit the "play" button; after that they don't want to think about it. There are plenty of other tutorials that will tell you how to do the equivalent of that for various programming tasks—this one won't help. But if you think of programming like playing the piano—a craft that can take years to perfect—then I hope this collection can help.

Index of Jupyter (IPython) Notebooks

For each notebook you can hover on the title to see a description, or click the title to view on github, or click one of the letters in the left column to launch the notebook on Colab, Deepnote, Mybinder, Sagemaker, or NBViewer.

RunYearNew
C D M N S2026Truncatable Primes
C D M N S2025Advent of Code 2025
C D M N S2025Advent of Code 2025: AI LLM Edition
C D M N S2024Advent of Code 2024
C D M N S2024Counting Cluster Sizes in Paint by Numbers
C D M N S2024LLMs, Theory of Mind, and Cheryl's Birthday
C D M N S2024Number Bracelets Game
C D M N S2024Overtime in American Football
C D M N S2024Stubborn number endings
C D M N S2024The Languages of English, Math, and Programming
RunYearProgramming Examples
C D M N S2022AlphaCode Automated Programming
C D M N S2022The Babylonian Number System
C D M N S2018Beal's Conjecture Revisited
C D M N S2020Bicycling Statistics
C D M N S2018Can't Stop
C D M N S2019Chaos with Triangles
C D M N S2017Conway's Game of Life
C D M N S2020Generating and Solving Mazes
C D M N S2024The Languages of English, Math, and Programming
C D M N S2021Mel's Konane Board
C D M N S2020Photo Focal Lengths
C D M N S2018Pickleball Tournament
C D M N S2017Project Euler Utilities
C D M N S2022Selecting Names from a Menu
C D M N S2020Tracking Polls: Electoral Votes
RunYearAdvent of Code
C D M N S2025Advent of Code 2025: AI LLM Edition
C D M N S2025Advent of Code 2025
C D M N S2024Advent of Code 2024
C D M N S2023Advent of Code 2023
C D M N S2022Advent of Code 2022
C D M N S2021Advent of Code 2021
C D M N S2020Advent of Code 2020
C D M N S2018Advent of Code 2018
C D M N S2017Advent of Code 2017
C D M N S2016Advent of Code 2016
C D M N S2022Advent of Code Utilities
RunYearProbability and Uncertainty
C D M N S2019Effectiveness of Language Models
C D M N S2018A Concrete Introduction to Probability
C D M N S2016Probability, Paradox, and the Reasonable Person Principle
C D M N S2020Estimating Probabilities with Simulations
C D M N S2023The Diamond Game: A Probability Puzzle
C D M N S2019The Devil and the Coin Flip Game
C D M N S2020Dice Baseball
C D M N S2018Economics Simulation
C D M N S2024Overtime in American Football
C D M N S2012Poker Hand Ranking
C D M N S2020The Unfinished Game .... of Risk
C D M N S2019WWW: Who Will Win (NBA Title)?
RunYearLogic and Number/Counting Puzzles
C D M N S2024Counting Cluster Sizes in Paint by Numbers
C D M N S2014Cryptarithmetic
C D M N S2018Euler's Sum of Powers Conjecture
C D M N S2020Four 4s, Five 5s, and Countdowns
C D M N S2020How to Count Things
C D M N S2021KenKen (Sudoku-like Puzzle)
C D M N S2024Number Bracelets Game
C D M N S2019Pairing Socks
C D M N S2018Sicherman Dice
C D M N S2014Sol Golomb's Rectangle Puzzle
C D M N S2024Stubborn number endings
C D M N S2021Star Battle (Sudoku-like Puzzle)
C D M N S2006Sudoku
C D M N S2021Sudoku: 100,000 puzzles/second in Java
C D M N S2020Square Sum Puzzle
C D M N S2020When is Cheryl's Birthday?
C D M N S2015When Cheryl Met Eve: A Birthday Story
C D M N S2024LLMs, Theory of Mind, and Cheryl's Birthday
C D M N S2015xkcd 1313: Regex Golf
C D M N S2015xkcd 1313: Regex Golf (Part 2: Infinite Problems)
RunYearWord Puzzles
C D M N S2020Boggle / Inverse Boggle
C D M N S2020Chemical Element Spelling
C D M N S2020Equilength Numbers: FOUR = 4
C D M N S2017Gesture Typing
C D M N S2017Ghost: A Word game
C D M N S2018How to Do Things with Words: NLP in Python
C D M N S2015Let's Code About Bike Locks
C D M N S2023One Letter Off
C D M N S2017Scrabble: Refactoring a Crossword Game Program
C D M N S2020Spelling Bee
C D M N S2017Translating English into Propositional Logic
C D M N S2020Wordle, Evil Wordle, Antiwordle, and Jotto
C D M N S2022Winning Wordle
C D M N S2017World's Longest Palindrome
C D M N S2020World's Shortest Portmantout Word
C D M N S2018xkcd 1970: Name Dominoes
RunYearThe Riddler (from 538)
C D M N S2022Anigrams: Word Chains
C D M N S2017Battle Royale
C D M N S2021Climbing Wall
C D M N S2021CrossProduct
C D M N S2020Flipping Cards; A Guessing Game
C D M N S2019Lottery
C D M N S2019How Many Soldiers to Beat the Night King?
C D M N S2017Misanthropic Neighbors
C D M N S2018Properly Ordered Card Hands
C D M N S2021Race Track
C D M N S2021Split the States
C D M N S2020Tour de 538
C D M N S2020Weighing Twelve Balls
C D M N S2020War. What is it Good For?
RunYearComputer Science Algorithms and Concepts
C D M N S2017BASIC Interpreter
C D M N S2017Convex Hull Problem
C D M N S2023Docstring Fixpoint Theory
C D M N S2020Stable Matching Problem
C D M N S2017Symbolic Algebra, Simplification, and Differentiation
C D M N S2017Snobol: Bad Grade, Good Experience
C D M N S2018Traveling Salesperson Problem
C D M N S2026Truncatable Primes

Index of Python Files

FileDescriptionDocumentation
beal.pySearch for counterexamples to Beal's Conjecturedocumentation
docex.pyAn obsolete framework for running unit tests, similar to doctest
ibol.pyAn Exercise in Species Barcodingdocumentation
lettercount.pyConvert Google Ngram Counts to Letter Countsdocumentation
lis.pyLisp Interpreter written in Pythondocumentation
lispy.pyEven Better Lisp Interpreter written in Pythondocumentation
lispytest.pyTests for Lisp Interpreters
pal.pyFind long palindromesdocumentation
pal2.pyFind longer palindromesdocumentation
pal3.pyFind even longer palindromesdocumentation
pytudes.pyPre-process text to generate this README.md file.
py2html.pyPretty-printer to format Python files as html
SET.pyAnalyze the card game SETdocumentation
spell.pySpelling correctordocumentation
sudoku.pyProgram to solve sudoku puzzlesdocumentation
testaccum.pyTests for my failed Python accumulation display proposaldocumentation
yaptu.pyYet 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. I still have my copy, but it is now easier to find a pdf than a hard copy.

Reviews of pytudes

Here's what some people are saying about pytudes:

  • "What I find interesting is how Peter builds bottom-up solutions using low-level utilities... Reading his code is educational." - Jeremey Howard, co-founder of fast.ai and chief scientist at Kaggle
  • "Everything I see from Peter Norvig is just always so incredibly well written and coded." — Jonathan, Hacker News
  • "Peter Norvig is my go to recommendation when someone is interested in becoming better at solving day to day problems ... I feel his skill of dividing a problem into small pieces and expressing them in code in a natural way is unparalleled." — mikevin, Hacker News
  • "I've never seen Peter Norvig choose anything but the most elegant and perfect data model for the problem at hand." — spoonjim, Hacker News
  • "I just find Norvig's style of "functional Python" lovely in its own way (with noted disregard of Pep8 and other "best practices")" —raverbashing, Hacker News
  • "You should check out Norvig's design of computer programs course on Udacity where he uses these kinds of puzzle programs to teach programming design concepts. It is a hard but really rewarding course. — nafizh, HN ACademy
  • "Often enough I would think of something [a possible improvement[, but if you worked it out in detail there was some less-obvious reason the code was the way it was... All the code is pretty short, and it's not really 'production code', but it's enough to be an education in craftsmanship at every level."
  • [What code samples should programmers read?] "Anything else implemented by Norvig, he's one of the best programmers that I've had the pleasure of reading code from." - jacquesm on Hacker News
  • "Everything I see from Peter Norvig is just always so incredibly well written and coded. Every year looking at his solutions for advent of code [0] brings just so much learnings. Strongly recommend. - jyepin Hacker News
  • "I feel his skill of dividing a problem into small pieces and expressing them in code in a natural way is unparalleled." - mikevin Hacker News