pytudes README

The project's README from github.com/norvig/pytudes. As one markdown file: README.md.

Peter Norvig
MIT License
2015-2026

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 open the notebook on colab or nbviewer.

Open Year New
co nb 2026 (How to Write a (Lisp) Interpreter (in Python))
co nb 2026 Approximating Pi with a Fraction
co nb 2026 Did you solve it? R y clvr ngh t rd ths sntnc?
co nb 2026 Largest prime factor
co nb 2026 Project Euler #1–100 by Fable LLM
co nb 2026 Project Euler #1–100 by Kimi LLM
co nb 2026 Project Euler #1–100 by Opus LLM
co nb 2026 Project Euler #1–100 by a Human
co nb 2026 Truncatable Primes
co nb 2025 Advent of Code 2025
co nb 2025 Advent of Code 2025: AI LLM Edition
Open Year Large Language Models
co nb 2022 AlphaCode Automated Programming
co nb 2025 Advent of Code 2025: AI LLM Edition
co nb 2019 Effectiveness of Language Models
co nb 2018 How to Do Things with Words: NLP in Python
co nb 2024 The Languages of English, Math, and Programming
co nb 2024 LLMs, Theory of Mind, and Cheryl's Birthday
co nb 2023 One Letter Off
co nb 2026 Project Euler #1–100 by a Human
co nb 2026 Project Euler #1–100 by Fable LLM
co nb 2026 Project Euler #1–100 by Opus LLM
co nb 2026 Project Euler #1–100 by Kimi LLM
Open Year Programming Examples
co nb 2026 Approximating Pi with a Fraction
co nb 2022 The Babylonian Number System
co nb 2018 Beal's Conjecture Revisited
co nb 2020 Bicycling Statistics
co nb 2018 Can't Stop
co nb 2019 Chaos with Triangles
co nb 2017 Conway's Game of Life
co nb 2020 Generating and Solving Mazes
co nb 2026 Largest prime factor
co nb 2021 Mel's Konane Board
co nb 2020 Photo Focal Lengths
co nb 2018 Pickleball Tournament
co nb 2022 Selecting Names from a Menu
co nb 2020 Tracking Polls: Electoral Votes
Open Year Advent of Code
co nb 2025 Advent of Code 2025: AI LLM Edition
co nb 2025 Advent of Code 2025
co nb 2024 Advent of Code 2024
co nb 2023 Advent of Code 2023
co nb 2022 Advent of Code 2022
co nb 2021 Advent of Code 2021
co nb 2020 Advent of Code 2020
co nb 2018 Advent of Code 2018
co nb 2017 Advent of Code 2017
co nb 2016 Advent of Code 2016
co nb 2022 Advent of Code Utilities
Open Year Probability and Uncertainty
co nb 2018 A Concrete Introduction to Probability
co nb 2016 Probability, Paradox, and the Reasonable Person Principle
co nb 2020 Estimating Probabilities with Simulations
co nb 2023 The Diamond Game: A Probability Puzzle
co nb 2019 The Devil and the Coin Flip Game
co nb 2020 Dice Baseball
co nb 2018 Economics Simulation
co nb 2024 Overtime in American Football
co nb 2012 Poker Hand Ranking
co nb 2020 The Unfinished Game .... of Risk
co nb 2019 WWW: Who Will Win (NBA Title)?
Open Year Logic and Number/Counting Puzzles
co nb 2024 Counting Cluster Sizes in Paint by Numbers
co nb 2014 Cryptarithmetic
co nb 2018 Euler's Sum of Powers Conjecture
co nb 2020 Four 4s, Five 5s, and Countdowns
co nb 2020 How to Count Things
co nb 2024 Number Bracelets Game
co nb 2019 Pairing Socks
co nb 2018 Sicherman Dice
co nb 2014 Sol Golomb's Rectangle Puzzle
co nb 2024 Stubborn number endings
co nb 2020 Square Sum Chain Puzzle
co nb 2020 When is Cheryl's Birthday?
co nb 2015 When Cheryl Met Eve: A Birthday Story
co nb 2015 xkcd 1313: Regex Golf
co nb 2015 xkcd 1313: Regex Golf (Part 2: Infinite Problems)
Open Year Sudoku and Similar Puzzles
co nb 2006 Sudoku
co nb 2021 Sudoku: 400,000 puzzles/second in Java
co nb 2021 KenKen (Sudoku-like Puzzle)
co nb 2021 Star Battle (Sudoku-like Puzzle)
Open Year Word Puzzles
co nb 2020 Boggle / Inverse Boggle
co nb 2020 Chemical Element Spelling
co nb 2026 Did you solve it? R y clvr ngh t rd ths sntnc?
co nb 2020 Equilength Numbers: FOUR = 4
co nb 2017 Gesture Typing
co nb 2017 Ghost: A Word game
co nb 2015 Let's Code About Bike Locks
co nb 2017 Scrabble: Refactoring a Crossword Game Program
co nb 2020 Spelling Bee
co nb 2017 Translating English into Propositional Logic
co nb 2020 Wordle, Evil Wordle, Antiwordle, and Jotto
co nb 2022 Winning Wordle
co nb 2017 World's Longest Palindrome
co nb 2020 World's Shortest Portmantout Word
co nb 2018 xkcd 1970: Name Dominoes
Open Year The Riddler (from 538)
co nb 2022 Anigrams: Word Chains
co nb 2017 Battle Royale
co nb 2021 Climbing Wall
co nb 2021 CrossProduct
co nb 2020 Flipping Cards; A Guessing Game
co nb 2019 Lottery
co nb 2019 How Many Soldiers to Beat the Night King?
co nb 2017 Misanthropic Neighbors
co nb 2018 Properly Organized Card Hands
co nb 2021 Race Track
co nb 2021 Split the States
co nb 2020 Tour de 538
co nb 2020 Weighing Twelve Balls
co nb 2020 War. What is it Good For?
Open Year Computer Science Algorithms and Concepts
co nb 2017 BASIC Interpreter
co nb 2017 Convex Hull Problem
co nb 2026 (How to Write a (Lisp) Interpreter (in Python))
co nb 2023 Docstring Fixpoint Theory
co nb 2020 Stable Matching Problem
co nb 2017 Symbolic Algebra, Simplification, and Differentiation
co nb 2017 Snobol: Bad Grade, Good Experience
co nb 2018 Traveling Salesperson Problem
co nb 2026 Truncatable Primes

Index of Python Files

File Description Documentation
beal.py Search for counterexamples to Beal's Conjecture documentation
docex.py An obsolete framework for running unit tests, similar to doctest
ibol.py An Exercise in Species Barcoding documentation
lettercount.py Convert Google Ngram Counts to Letter Counts documentation
lis.py Lisp Interpreter written in Python documentation
lispy.py Even Better Lisp Interpreter written in Python documentation
lispytest.py Tests for Lisp Interpreters
pal.py Find long palindromes documentation
pal2.py Find longer palindromes documentation
pal3.py Find even longer palindromes documentation
pytudes.py Pre-process text to generate this README.md file.
py2html.py Pretty-printer to format Python files as html
SET.py Analyze the card game SET documentation
spell.py Spelling corrector documentation
sudoku.py Program to solve sudoku puzzles documentation
testaccum.py Tests for my failed Python accumulation display proposal documentation
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. 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:

pytudes (norvig/pytudes)

Searching Database…

24.4K ·GitHub
这是什么?Pytudes 是 Peter Norvig 的个人作品集,收录了一系列短小而刻意设计得很难的 Python 程序和 Jupyter 笔记本。每一个都是为了打磨某项特定的编程技能而写的,名字借鉴了音乐中的练习曲。
这是我可以导入的库,还是一组独立的笔记本?它不是库,而是一份索引,列出了几十个相互独立的 Jupyter 笔记本和普通 .py 脚本。每个都针对一个谜题或算法,需要单独打开使用,而不是导入。
我该如何使用这些笔记本?从 README 的索引表格中选一个条目,点击其 “co” 链接即可在 Google Colab 中打开,或点击 “nb” 在 nbviewer/GitHub 上查看;也可以直接克隆仓库,运行 .py 文件。
运行它们需要什么?只需要 Python 3;如果是笔记本,还需要 Jupyter,或者通过 Google Colab 在浏览器中运行。仓库没有声明额外的 pip 依赖,也没有提供 Dockerfile。
这是适合新手的分步教程吗?不是。Norvig 明确将它与“安装即上手”的教程区分开来:它面向的是愿意把编程当作需要多年磨练的手艺的人,而不是快速浏览式的入门指南。
“pytudes”这个名字有什么来历?这个名字由 “Python” 和 “étude”(练习曲,指为打磨某项特定技能而写的短篇乐曲)组合而成。Norvig 把同样的理念应用到了编程练习上。
它包含 Advent of Code 的内容吗?包含。它提供了 2016 年至 2025 年 Advent of Code 的解法,其中包括一个 2025 年的 “AI LLM Edition” 笔记本,用于比较 LLM 生成的解法。
有没有对比人类与 AI 解题的笔记本?有。一组 2026 年的笔记本分别由人工解答,以及由 Fable、Kimi、Opus 三个 LLM 解答 Project Euler 第 1 至 100 题,以便对比。
除了谜题,它还涵盖哪些主题?涵盖概率与不确定性、数独式逻辑谜题、文字游戏、FiveThirtyEight 的 Riddler 专栏,以及 Lisp 解释器、旅行商问题等计算机科学核心主题。
Creator
norvig
Size
136.4 MB
Stars
24.4K
Updated
CommitOct 05
Age
9y
Commits · 90 Days