HACKER Q&A
📣 fdeage

Interesting 2-3h coding projects in Python?


I recently switched jobs to become a full-time Python teacher. I am going to teach a 60h course next month so I am looking for interesting projects related to algorithmics, basic data processing, OOP, etc. My course is split into 3h sessions so I need rather small projects (2-3h).

Any suggestions?


  👤 oftenwrong Accepted Answer ✓
Make-like build system. This would expose students to a few useful concepts, and can be a 'jumping-off point' into various more advanced concepts.

- topological sorting the build graph - what is a graph - running child processes - what a process is - process api - interaction with the filesystem - r/w files - mtime comparisons - how computers store time - what is incremental execution

I would suggest to skip parsing, and use a Python literal to hold the 'Makefile'-equivalent dependency graph data structure.

You let students come up with their own fun build graphs, like making sushi:

tuna_maki -> nori, cooked_rice, tuna_fillet, chef, sushi_roller

cooked_rice -> uncooked_rice, rice_cooker, water, rice_seasoning

tuna_fillet -> tuna_slab, knife

tuna_slab -> fishmonger, money

nori -> algae, dehydrator

And then, when executed, it would print the steps, or say that a target was already made.


👤 jventura
Depending on the level of your students, if you get the chance to talk a little bit about sockets, you can always guide them to build a very simple HTTP Server. In reality, you don't need to go much deep on sockets, just talk about send() and recv(), and in very simplistic terms. You can check this [1] blog post of mine, and the final code is very simple but very useful to learn how the "internet" works..

Good luck!

[1] https://joaoventura.net/blog/2017/python-webserver/


👤 is_true
Maybe a data store?

Persist data -> search it -> too much data, need an index -> search on that index -> keep that index updated

I think you can split that in couple of parts to teach it in a few sessions and then join everything in one project, which when I started with Python it was hard for me to understand.


👤 ogou
Pygame is a good library to generate multimedia. I'm sure you could come up with some exercises with it.

Also, convert data in a PDF to a CSV file. I have needed to do that many times over the years and learned a lot of Python by improving my approaches.


👤 jordiburgos
Just found this in HN before:

https://app.codecrafters.io/catalog

You can get any of those projects and chop it down to fill the time you need.


👤 schwartzworld
Games are always a good way to learn, imo. I make a lot of little games for my kids and try out programming techniques along the way.

👤 gwnywg
Try building bots in codingame.com, 2 hours should be enough to build something that works :)

👤 r_sz
RPN calculator? If it's too short project, you can extend it with some extra functions.

👤 croo
Advent of code is always fun.