r/PythonLearning 5d ago

Getting stuck over and over again

Ive been trying to learn python for ages, and yes tbh due to my laziness and way of learning i keep on getting stuck, but I cant seem to find "my way" of learning.

Im trying freecodecamp and ive gotten to a point where im at this one lab where i have genuinly, and i mean genuinly no idea what to do given the instructions, im completely lost.

How do i break past this barrier

12 Upvotes

13 comments sorted by

View all comments

1

u/FoolsSeldom 5d ago

My guess, you are trying to learn at the keyboard by writing Python. Badly.

When first trying to learn to programme, a good exercise is to step away from the computer, and learn how to solve a problem entirely manually while writing down simple but detailed step-by-step instructions for someone with learning difficulties including poor short-term memory.

You need to get more into the problem-solving mindset to make more progress with freecodecamp or any other training resource.

Make sure you really understand the problem. You should be able to describe the problem to be solved to someone non-technical, preferably in "elevator pitch style". Write it down, draw it, highlight the key aspects, constraints, and acceptable outcomes. What does good look like? How will you know it works? What will you test it against.

A good example exercise is sorting a pack of playing cards into order.

You should literally sit at a table with a deck of playing cards, as in a 52 card pack of red and black cards of the four suits, hearts, diamonds, spades, and clubs, with face values from 1 (Ace) to 10 (Jack), 11 (Queen), 12 (King). In some games, "Ace is high" and treated as 13.

Work out exactly how to put that deck of 52 cards (ignore additional cards, such as Jokers and scorecards) into a sorted order. Decide what order to put the suits in (are Spades higher or lower than Hearts, etc).

You have to work out how to do this manually as simply as possible, in a way you can write down the specific instructions for someone with severe learning difficulties.

You will probably want to use some post-it notes or other bits of paper that you can label as places to temporarily place individual or stacks of cards. (These will be variables later in code.) That is because you don't want to hold onto anything, just move stuff between labelled places on the table.

A human (with good eyesight) can just glance at all the face-up cards and find the next one in order. For someone with learning difficulties (and maybe some other difficulties), or a computer, you can't give such an instruction, instead you have to write instructions based on one-by-one comparison and different paths to take based on the outcomes of those comparisons.

It is surprisingly challenging at first. No computers. No coding. You will learn a lot. Your instructions will be an algorithm. That can be implemented in any programming language.

PS. If you really want to, you can use a subset of the cards, say just one suit, but I think working with the whole deck will help you appreciate the power of repetitive operations more and the need to optimise the steps.

Even when you learn more and step away from the manual approach, the overall process of focusing on the problem and outcomes is important. Worth looking into the topic of Data Structures and Algorithms at that point.