I'm currently taking a Python course on Udemy and often find myself stuck on certain instructions. I usually give myself around 30 minutes to an hour to work through the challenge before checking the solution. It turns out I often have the right idea but struggle with the order of the code implementation or overlook simple details, leading to those frustrating 'duh' moments.
My main question is: As a beginner, should I focus more on understanding why my code fails after looking at solutions rather than just trying to solve the problems myself? Is it better to spend a long time trying to figure things out, or is it more beneficial to learn from my mistakes quickly?
5 Answers
If you keep getting stuck on basic problems, it might be a sign to really nail down those fundamentals first. You don’t need to rush through; it’s fine if you don’t solve every problem at once. Focus on grasping the core concepts, and remember, there are often multiple ways to tackle a problem.
Whenever you hit a wall, instead of spending too long struggling, check the solutions to understand them better. Modify the example slightly and see how those changes affect the results. Soon enough, those lightbulb moments will become more frequent!
I totally get your struggle! Real-world coding often involves a lot of research, so try looking for solutions online without just skipping straight to the answers. Learning how to debug by figuring out where the issues are in your code will pay off. It’s okay to take it slow and really understand the process.
Try breaking your problems down as small as you can. Use print statements to check your variables and see where things go wrong. Understanding the flow of your code is crucial before jumping to more complex challenges. Just like in math, mastering the basics will make everything else much easier later on.
I think it could be helpful to take a step back and reflect on what you’ve learned after sessions. Keep a little dev diary to summarize your progress and revisit it at the start of each session. Experiment with the code, try different approaches, and give yourself grace during this learning journey!

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically