Have you had a look at
codecademy? Admittedly a lot of their Python code exercises start really basic, but they've got a whole lot of more of them there now for more advanced topics like working with statistics/machine learning, working with data structures and algorithms, and so on:
View attachment 1011849
Now it says 'Pro' and they'll try to charge for these. But here's the
pro-tip (if you'll pardon the pun): when you create a (free!) account for the first time, they give you 7 days free access to any of the pro courses, and most of those advanced topics only have the Python/Python3 course as their prerequisite. So there's nothing stopping you from creating as many new accounts as you want with dummy email addresses, speedrunning the basic Python course, and then you've got a whole week to work through one of the other, more advanced courses.
Alternatively, and depending on how deep you want to go with it, a lot of the
computer science courses on MIT OpenCourseWare use Python as their programming language. For instance, here's their
Intro to Computer Science and Programming 6.0001 course that includes freely-available lecture videos, notes, and walk-through problem sets, e.g.
View attachment 1011851
More advanced is their
Introduction to Computational Thinking and Data Science 6.0002 course, with free video lectures, psets, etc that assumes a solid grasp of Python (as you would have by the end of 6.0001 for instance) and looks at some basic optimization and machine learning stuff. Or their
Introduction to Algorithms 6.006 course, again with video lectures, psets, etc that uses Python to explore some more advanced algorithms/data structures. So all of those would give you plenty of interesting exercises and challenge problems to do, and at the same time doubles as an introduction/refresher on various useful algorithms/data structures.
However, all of that said:
Really, and in my experience, the best way to exercise your skills with a language is to just pick a project and dive right in!
@Angry Shoes' calculator suggestion is a classically great idea, particularly since you can easily break it up into well-defined steps that exercise various 'muscles' in your Python repertoire, e.g.
- First step: can we construct like a Calculator class (and properly document it, and write test cases, etc) and write a small command-line app that lets a user input numbers and operators and correctly returns the right result?
- Then when that's working, can we—using that same tried-and-tested Calculator class—extend and develop a simple GUI interface (e.g. using Tkinter) that lets a user press buttons and perform the same arithmetic operations that they could in the CLI program? (For bonus exercise, don't use a form editor like pygubu or anything: do it all programmatically! It's fun and not too hard: draw out on paper what this Calculator window has to look like, and then it's actually quite straightforward to work out exactly how you need to layout each of the graphical widgets. Then you just code that.)
- Then when that's good and working, can we use that same well tried-and-tested Calculator class and make a web app that runs on a (local) web server, that looks similar to the GUI one, and that also lets a user press buttons and perform the same arithmetic operations that they could in the CLI and GUI programs? (e.g. this gives you a perfect excuse to play with the Django framework in a low-stress, toy-application setting, but you could use something like Flask too).
The benefit of this sort of a structure is that each of those steps is totally self-contained. In Step 1 you work with the classes and data structures and functions that form the working backend of your program. Then in Step 2 you just need to focus on working with GUI widgets and event callbacks, since you (
ideally) hammered out all of the arithmetic/logic/IO related issues in Step 1. Then in Step 3 you can focus all your attention on the web-dev side of things, since you would've (
ideally) nailed down all the nuances of getting the buttons/viewing window working the way you want with the GUI stuff in Step 2.
So yeah, go for it! For your weather report scraper, perhaps break it up into the same sort of manageable, self-contained chunks that you build up into the final software app that you want. For example,
- Write a CLI program that can scrape data from a relatively well-behaved website and echo it to the command line (e.g. write a program that retrieves and regurgitates all this text that I've written in this Kiwi Farms post!)
- Then extend and write a CLI program/script that scrapes the specific weather report data that you want from your chosen weather site (which may or may not be straightforward depending on how much of a pain in the ass the weather website wants to be, which is why Step 1 is a more useful starting point for nailing down using Python to send/read http/database messages).
- Then once you've got a CLI script that you run and it goes and scrapes the correct weather report data, then extend the script so that instead of echoing it back, it sends it to you in a text/email/whatever.
- Then once you've got this script that you run and it blows up your phone with the current weather report, then look into automating running that script so it runs every morning or so.