Pennsylvania State University has a great and free online course 'GIS Programming and Automation' at: https://www.e-education.psu.edu/geog485/ There's a reasonable amount of theory and a lot of exercises with step by step explanations.
If you time it right, you can catch it on sale and it takes about 40 hours to complete if you don't rush too much. The thing about their course I was so impressed with was that their instructors looked at all my code, even if I correctly finished projects, and that helped me out a lot.