Compare commits

...

3 Commits

Author SHA1 Message Date
Peter Norvig
8d1ab724c5 Add files via upload 2026-03-07 16:04:50 -08:00
Peter Norvig
6b584053ed Update year references for Advent of Code entries 2026-03-07 16:03:49 -08:00
Peter Norvig
b1156d3c43 Add files via upload 2026-03-07 15:53:41 -08:00
2 changed files with 21 additions and 5 deletions

View File

@@ -13,7 +13,6 @@ This project contains ***pytudes***—Python programs, usually short, for perfec
To continue the musical analogy, some people think of programming like [Spotify](http://spotify.com): 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](https://norvig.com/21-days.html) 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
@@ -187,9 +186,25 @@ For each notebook you can hover on the title to see a description, or click the
|[yaptu.py](/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. I still have my copy.
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](txt/Etudes.pdf) than a hard copy.
![](https://images-na.ssl-images-amazon.com/images/I/51ZnZH29dvL._SX394_BO1,204,203,200_.jpg)
# 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](https://en.wikipedia.org/wiki/Jeremy_Howard_(entrepreneur)), 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](https://news.ycombinator.com/user?id=jypepin), [Hacker News](https://news.ycombinator.com/item?id=27379366)
- "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](https://news.ycombinator.com/user?id=mikevin), [Hacker News](https://news.ycombinator.com/item?id=27379366)
- "I've never seen Peter Norvig choose anything but the most elegant and perfect data model for the problem at hand." — [spoonjim](https://news.ycombinator.com/user?id=spoonjim), [Hacker News](https://news.ycombinator.com/item?id=27379366)
- "I just find Norvig's style of "functional Python" lovely in its own way (with noted disregard of Pep8 and other "best practices")" —[raverbashing](https://news.ycombinator.com/user?id=raverbashing), [Hacker News](https://news.ycombinator.com/item?id=25654955)
- "You should check out Norvig's design of computer programs [course on Udacity](https://imp.i115008.net/c/2331964/788805/11298?u=https://www.udacity.com/course/design-of-computer-programs--cs212) where he uses these kinds of puzzle programs to teach programming design concepts. It is a hard but really rewarding course. — [nafizh](https://news.ycombinator.com/user?id=nafizh), [HN ACademy](https://yahnd.com/academy/r/udacity.com/course/design-of-computer-programs--cs212/)
- "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](https://news.ycombinator.com/user?id=jacquesm) on [Hacker News](https://news.ycombinator.com/item?id=14487724)
- "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](https://news.ycombinator.com/user?id=jypepin) [Hacker News](https://news.ycombinator.com/item?id=27379366)
- "I feel his skill of dividing a problem into small pieces and expressing them in code in a natural way is unparalleled." - [mikevin](https://news.ycombinator.com/user?id=mikevin) [Hacker News](https://news.ycombinator.com/item?id=27379366)

View File

@@ -23,8 +23,8 @@ notebooks = {
'How many electoral votes would Trump get if he wins the state where he has positive net approval?')],
'Advent of Code': [
('Advent of Code 2025: AI LLM Edition', 2024, 'Advent-2025-AI.ipynb', 'Using large language coding models to solve AoC puzzles'),
('Advent of Code 2025', 2024, 'Advent-2025.ipynb', 'Puzzle site with a coding puzzle for 12 days of Christmas, December 2025'),
('Advent of Code 2025: AI LLM Edition', 2025, 'Advent-2025-AI.ipynb', 'Using large language coding models to solve AoC puzzles'),
('Advent of Code 2025', 2025, 'Advent-2025.ipynb', 'Puzzle site with a coding puzzle for 12 days of Christmas, December 2025'),
('Advent of Code 2024', 2024, 'Advent-2024.ipynb', 'Puzzle site with a coding puzzle each day of Advent, December 2024'),
('Advent of Code 2023', 2023, 'Advent-2023.ipynb', 'Puzzle site with a coding puzzle each day of Advent, December 2023'),
('Advent of Code 2022', 2022, 'Advent-2022.ipynb', 'Puzzle site with a coding puzzle each day of Advent, December 2022'),
@@ -143,6 +143,7 @@ import re
import urllib.request
current_year = 2026
new_year = current_year - 2 # What `find_newest` looks for
def read_url(url: str) -> str:
"""Reads a file from the specified URL and returns its content as a string."""
@@ -178,7 +179,7 @@ def format_notebooks() -> str:
find_newest(notebooks)
return '\n'.join(format_category(name) for name in notebooks)
def find_newest(notebooks, label='New', year=current_year-1) -> None:
def find_newest(notebooks, label='New', year=new_year) -> None:
"""Mutate `notebooks['New']` to have a collection of newest notebooks."""
for category in notebooks:
for line in notebooks[category]: