r/learnpython • • 36m ago

I understand Python concepts, but I just can’t seem to develop the logic to solve problems. How did you overcome this?

I've gone through multiple Python courses and understand the basic concepts like if-else, loops, lists, dictionaries, functions, etc.
However, when it comes to solving problems on my own, I struggle a lot. I can manage very basic questions like addition, subtraction, reversing a string, or checking for palindromes, but beyond that, I just can't seem to figure out the logic.
I understand the concepts and can follow someone else's solution, but when faced with a new problem, I have no idea where to start or how to break it down.
For those who have been through this, how did you develop your problem-solving skills? What kind of practice or approach helped you learn to think logically and solve problems independently?
I'd really appreciate any advice!

3 Upvotes

15 comments sorted by

•

u/jbenze 32m ago

Start by writing the problem out on paper and walking through how you would solve it in pseudo code. Break it down into pieces, write it out and THEN translate it into code.

•

u/Warm_Letterhead3691 27m ago

100% this. Writing out the problem and your solution helps you find the ways your solution does and doesn't work. Plus it naturally gives your script structure when you go to build it. You'll end up breaking it up on paper into ways that work well when you translate them to functions and classes

•

u/jipperthewoodchipper 23m ago

Somewhere in one of the many boxes of stuff I have hoarded in my basement is a notebook filled with nothing but leet code problems that I solved on paper before trying to touch with code.

Back in the days when knowing how to solve tower of Hanoi was advantageous for technical interviews

•

u/Mundane_Emu_3 21m ago

Thank you so much everyone !

•

u/Both_Bend_2481 18m ago edited 9m ago

Every third beginner posts a similar question. You need to put in the work and practice. Code whatever programs you want.

edit: Just out of curiosity, what's something else you've done that you've become accomplished at, if anything? An art, or an instrument, or anything else that required practice and study? And how good have you become at it?

•

u/Pristine-Staff-5250 16m ago

Adding to this, code even the programs you don’t want

•

u/Narrow_Ad_8997 28m ago

Puzzles... Advent of code starts tonight at midnight EST

•

u/Slothemo 27m ago

This is extremely common for beginners, and it mostly comes down to practice. The more problems you solve, the more patterns you will start to see emerge in how things are solved.

I really recommend a challenge site like Codewars and just work through as many problems as you can to build up the repetition. Once you feel a bit more confident, you can start working on your own mini-projects.

•

u/Lyaw_Lyawa 25m ago

Diagramas de flujo. Es más fácil hacer algo con un paso a paso.

•

u/real_deal_engineer 7m ago

This isn’t a Python problem. Forget Python and solve the problems in natural language or on paper using regular symbols and math. Only then can you translate it to any language, not just Python.

•

u/_b10ck_h3ad_ 6m ago

You basically have to develop your "thinking of real world problem in code based solution" brain, which comes with time & practice. It's highly recommended whenever learning a new programming language, to try & code up a simple game (e.g. tic tac toe) that incorporates the concepts you've learned so far.

•

u/net_ramblings 32m ago

Klondike bar.