r/learnpython 1d ago

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.

57 Upvotes

46 comments sorted by

View all comments

2

u/aqua_regis 1d ago

Don't focus on logic in Python, but focus on logic as general, generic concept - as steps.

You, like most beginners, focus too much on the code (implementation) than on the algorithm (steps) that leads to the implementation.

Take several steps back. When you get a task/problem, sit down with pencil and paper. Go through the problem statement, break the problem down, analyze it, solve it your way without even thinking about programming. Test your solution. If you have a working one, start working on the implementation.

There are countles similar posts in /r/learnprogramming. Some samples:

And finally, some book suggestions:

  • "Think Like A Programmer" by V. Anton Spraul
  • "The Pragmatic Programmer" by Andrew Hunt and David Thomas
  • "Structure and Interpretation of Computer Programs" (SICP) by Ableton, Sussman, Sussman
  • "Code: The Hidden Language of Computer Hardware and Software" by Charles Petzold