Python challenges or projects with just the standard library?
I've been slowly learning python for some months already. I used the Python Crash Course book from No Starch Press, it teaches the basics and then goes on with some projects with pygame, matplotlib, etc.
However, I feel that my Python skills aren't very good yet, and before learning to use libraries I would like to have a better command of the standard library.
I have been looking for some book with projects or, even better, challenges using just the standard library, but haven't found any good ones. Most of them either are for absolute beginners, or use additional libraries, or are very technical and without focus on practice.
Do you know of any good book or resource with challenges or projects that don't depend on additional libraries? Or, do you have any idea for a project or challenge using just the standard library?
Thanks in advance!
I usually go to Advent of Code or Project Euler to tinker with a new language
Advent of Code seems to be what I was looking for! Regarding Project Euler, I'm not very strong at mathematics, but at least the first problems seem to not require very advanced maths. Thank you!
Also check out Project Lovelace for more science-y oriented challenges.
That one seems really fun, I like that they also have a "time sink" rating haha.
I'm garbage at maths but I use project Euler--partly to get better at it--but mainly to learn C and then when I saw how much easier it was Python.
I started from the first problem and worked my way up from there. At least in the beginning, highschool maths is sufficient and it's not like you can't reserch things just avoide the phrasing used in the question. Over all I recon it was the best tool I tried, mind you it's just a hobby for me.
The freedom to approach the problem as you want is very much what forces the learning process. The forum you access once the question is correctly awnsered is in valuble. You've already spent time thinking about and have your own solution so reading others work--and sometimes an official pdf awnser--is far more relevant.
As an example it took my laptop 20 mins to calculate an awnser to a question involving primes, I felt pretty proud, it was my solution after all. Once I'd read the official awnser and a quick rewrite; it solved in under a second. Sure if I'd known my basic maths I'd have used the simpler and more efficient method but what can you do, at least I got the awnser in the end rather having it handed to me as part of a pre-planned exercise with each step broken down in absurd minutia.
Math isn't my strong suit either! A lot of them are solvable with basic math, but can be improved/get better performance if you know more advanced math
I think python koans might help too.
Thank you! Looks promising.
The hangman game seems like would be easy enough, maybe I get started with something like that. The Sudoku one could be interesting as well, probably getting an optimal solution (and not just kind of bruteforce-ish one) will be challenging.
Thanks!
I didn't understand @stu2b50 's comment because my maths are slightly above high school level (I started a computer science degree but dropped from it after the first semester), and I figured that I'll learn about that when the time comes. Your comment, I understand better. I have started with some Project Euler challenges, but now you got me thinking about the Sudoku solver, and it's way more interesting that I had considered before. So maybe in a couple of days I'll start with it. Only I'm a bit intimidated haha.
This is very helpful, thanks! If it's okay with you, can I DM you here when I have a working solution so I can get some feedback?
You can pretty quickly reduce CSP or 3SAT into a general Sudoku puzzle, i.e Sudoku is NP-hard (and NP-complete, of course).
So, uh, bruteforce-ish is about as good as you'll get.
Now, that's in the general case. In reality, something like backtrace search will get the solution usually quicker than exponential time.