Isn't it a pretty standard book/memoir template?

He could have invested in a Python syntax highlighter. I use minted, myself, but I'm sure there are many alternatives.

There's actually a source tex file bundled with exercises with a custom setup.tex which makes me believe the whole thing is bespoke. Might be wrong though

https://websites.umich.edu/~mejn/cp2/exercises.html

By the way, I use typst now, so I don't have to worry about highlighting anymore!