I've been studying Python seriously for about eight months while working full time as a physical therapist, so most of my coding happens late at night or on weekends. I understand the larger concepts reasonably well, but I often get stuck on small implementation details and feel tempted to copy a working snippet without fully understanding it.
I want to learn how to reason through unfamiliar problems rather than merely make the code run. I've tried looking at a solution, hiding it, and then reconstructing it from memory. Sometimes that helps, but other times I spend 20 minutes staring at the problem and make no progress. With only about 45 minutes available before bed, the pressure to use the quickest solution is even stronger.
What helped you develop the ability to work through problems independently? Was there a change in how you approached learning, or is it mainly a matter of solving enough problems over time?
5 Answers
Looking up a solution isn't automatically cheating. Treat it like studying a chess tactic: first learn the idea, then practice recognizing when it applies. After reading an answer, break it into small pieces, explain what each line does, run experiments, and then rewrite it in your own way. The important part is being able to use the same idea in a slightly different situation.
When using coding tools, keep them in a hint-giving role. Ask what to inspect next, which assumption is wrong, or what concept applies, rather than asking for a finished implementation. Turning off automatic completions for a while can also make you pause and think before accepting a suggestion. The tool should nudge your reasoning, not replace it.
I usually compare several approaches instead of grabbing the first snippet I find. Then I decide which one fits my project, why it works, and what tradeoffs it has. Once you understand the code, copying or adapting it is fine; professional programming isn't about reinventing every common solution. The goal is to make an informed choice rather than paste blindly.
There really is no substitute for working through problems. Books, documentation, and existing code can point you in the right direction, but debugging and struggling with your own programs build the intuition. You can also spread one problem across several days instead of treating every session as a race to finish within 45 minutes. Repeatedly returning to the same problem gives your brain time to form the connections.
A useful middle ground is to study the answer carefully, close it, and return later to reproduce the approach from memory. That uses active recall instead of passive copying. If you're completely stuck, ask for a small hint or an explanation of the mistaken assumption rather than requesting the complete solution. You still have to make the key connection yourself.

Commenting every line with what I think it does, then checking those assumptions with print statements, helped a lot. Being wrong about a line is often what makes the concept stick. Also, 45 minutes after a full workday may simply not be your best time for difficult reasoning.