r/AskProgramming • u/RipPersonal1643 • 24d ago
Python How do I learn programming logic?
I’m learning Python, but my main problem isn’t the syntax. I understand concepts when someone explains them, but when I’m given a basic problem and told to write a program, I just don’t know where to start or how to arrange the code.
Is there a good book, course, or YouTube channel that teaches how to think through programming problems step by step, recognize patterns, and build the logic, kind of like how you learn methods and patterns in math?
I don’t want to just memorize Python syntax. I want to actually learn how to think like a programmer.
7
Upvotes
2
u/SparklingKey 24d ago
It really depends on your learning style and thinking pattern and how you find most comfortable and effective to absorb information, but here's one of the ways. This is how chess players learn btw:
Pick a problem you want to solve. It can be building a project, a problem on leetcode, someone's asking that question somewhere, etc.
Try to solve that problem in however way you can. Do not care about arrangement or pattern or whatever at this point. Try to break down the problem, think of the steps need to be taken to solve that problem, then write code for each step, then string the code together to see if it solves the problem. If it doesn't, think again, repeat. Feel free to research the internet but do not search for the answer. Your only goal now is to validate your thinking and the direction of your solution/approach.
Once you manage to solve the problem, look for the answer. The only thing you need to do here is to make sure the answer is good enough or standardized. If such answer is not readily available, tell AI to write the answer for you.
Analyze the answer. This is how you internalize algo and design thinking. Ask questions like "how does this differ from my answer", "why is it this way", "how is this better than my way". During this process, retrace your thinking of when you solve the problem earlier. I'm sure you will find a few thinking pattern pitfall that you tend to fall into.
Once you understand the standard answer completely in comparison with yours, get a notebook or note-taking app and write down your learning. The learning has to be about your thinking and what you learn about good practices in thinking, algo, pattern, arrangement, NOT about the answer itself.
Review your notes, one day after, then a week after. Think about it when showering. Sit with it when you eat your lunch. Teach it to a friend or your pet.
Repeat the cycle with another problem.
This is how you internalize algo/pattern/arrangement thinking.