norvig/pytudes

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

Jupyter Notebook

24,412

1,186 commits

updated Sep 16, 2026

See the code
demonstrate-skills
practice
programming
python
python-3

README

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.

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

Contributors

(top 30 of 45)

norvig

1,109 commits

ghurley

5 commits

Naereen

4 commits

norvig/pytudes

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

Jupyter Notebook

24,412

1,186 commits

updated Sep 16, 2026

See the code
demonstrate-skills
practice
programming
python
python-3

README

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.

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

Contributors

(top 30 of 45)

norvig

1,109 commits

ghurley

5 commits

Naereen

4 commits

Languages

Jupyter Notebook

98.6%