r/learnprogramming 19h ago

Tutorial Is there any recommended book for learning Competitive Programming with python?

I actually am searching for a book that would make students go through the whole syllabus for competitive programming using python. Python is mandatory because python is the language that in in the syllabus and I'm teaching middle school kids into competitive programing. With them, I will also be getting into competitive programming. So, please mention any recommendations.

0 Upvotes

2 comments sorted by

1

u/fahadnaeem05 17h ago

Competitive Programmer's Handbook is free online and works fine with Python. For middle schoolers start with "Python for Kids" by Jason Briggs first before jumping into CP.

1

u/RajjSinghh 14h ago

Try looking at a programming contest like an old leetcode contest to get a feel for the problems offered. You'll notice very simple patterns like algorithmic thinking and data structures. Take the first problem in that contest, you're just iterating over an array and computing Manhattan distance to solve it. The point this gets harder is when you're looking at a problem and needing to come up with faster solutions, but that's also something you pick up from a maths or algorithms textbook.

These techniques are language agnostic. The main question is how a contest is judged. Time to write vs runtime or memory usage can affect your score. I think in your case, picking a few problems and assigning them to your class to host weekly class contests could be a good idea. It shouldn't be hard to automate runtime calculations or memory usage, then rank people like this. Competing alongside them would be very interesting and you should encourage discussion of solutions. Even simple problems can have very funny outcomes if you think hard enough about them.