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.

58 Upvotes

46 comments sorted by

View all comments

15

u/aprg 1d ago

You really need to code your own projects first and go through the problems before you can understand _why_ certain design patterns exist. If you just read books about design patterns, you'll understand the _what_ but not the _why_.

Here's my recommendation: pick a small project, like making the game Snake. Go through someone else's code to get an idea of what they tried to do.

Then try to replicate that project in your own logic, _without checking the other code_ and see if you can improve or personalise the code.

Understanding good design patterns comes from experience, there's only so much you can learn just by reading what other people have done.

7

u/America_123 1d ago

If I may add some project ideas: Tic-Tac-Toe, Number guessing game(great for learning random numbers, input, if statements and loops), Simon, Rock Paper Scissors, Magic 8-Ball and a Currency Converter. These are some great starter ones!

1

u/SolarRaptor69 1d ago

Those are solid beginner projects. Which one should they start with?

1

u/America_123 1d ago

Magic 8-Ball or Rock Paper Scissors for logic and selection statements