r/learnprogramming • • 21d ago

Tutorial How can I get from following tutorials to actually writing the code myself?

I have started learning python and recently completed Numpy I have now started learning pandas.

The problem is i can understand the code when someone explains it or I can follow along with tutorials but writing the same thing by myself is hard.

So how do I get better at writing code without looking at tutorials or using ai?

And should i focus more on exercises or making projects?

What should I do differently than what I'm doing now to get better?

6 Upvotes

16 comments sorted by

4

u/TheRealKidkudi 21d ago

The easy answer is “write some code without using tutorials.”

But a better answer is to consider what you’ve already learned from tutorials, then think creatively about how you can apply that to build something you haven’t read in a tutorial. From there, try to build it and look up solutions to the problems you run into along the way. Try to read the actual documentation and try to avoid AI or another tutorial. Research specific errors you hit, then try to reason about your code and how you might change it to resolve the error.

It’s OK if the idea is dumb and pointless. it’s absolutely OK if someone else has already built something similar. It’s OK if what it does is small and not very flexible. None of that matters. The important part is that you come up with something that has a clearly defined objective, and then you figure out how to go from an empty editor to an application that does what you wanted.

A good exercise is to list out the things you’ve learned and a brief summary of what it does. Then you just need to connect the dots for any type of project idea that combines those things into a nicely defined piece of software and give it a shot!

Also, don’t be afraid to go back to your old code you did write from a tutorial to re-learn or better understand how you did something. It’s not cheating to look at old code, and it can be quite educational to take some code you’ve written in the past and adopt it to work with the project you’re working on now. 

1

u/vectorvelocity0 21d ago

Looks like I've been collecting tutorials instead of collecting coding experience 😂 Thanks 🙏🏻 genuinely going to try this!

1

u/unwashed_but_washed 19d ago

Something I usually do when learning say some new concept/paradigm/language.

You take some tutorial which sort-of aligns with something you're envisioning. But then you apply it to a slightly different problem.

So since you mentioned numpy/pandas: use a different data-set. filter for your own keys based on what you're interested in. (You'll probably need to learn about cleaning/mapping more iteratively because you don't have a curated tutorial data-set.)

Basically, use the same components, order them differently based on how you think they should be ordered for the other problem you're solving. It helps you develop a semantic mapping rather than rote-copying.

1

u/ExABogdan 21d ago

>Look at 5 minutes of the video
>Pause video and open IDE
>Disable autocomplete
>Try to remember what the person was trying to achieve
>Start typing
If you don't remember syntax or how the algorithm is supposed to be structured don't go back to the video, read documentation or StackOverflow . There's no learning or adaptation without struggle so try to get mad and frustrated for at least 10 minutes before using AI (ask it to explain and not give you the answer directly). Also don't overdo it, you can't memorize everything immediately so concepts are way more useful than syntax remember that.

1

u/vectorvelocity0 21d ago

yeah i think my biggest mistake has been going back to tutorials too quickly whenever I im stuck I'll disable autocomplete and try to reconstruct the logic myself first ill start following this approach Thanks!

1

u/MrBengaliHacker 21d ago

I can relate to this because I struggle with the same thing sometimes. When I'm following a tutorial, everything makes sense, and I feel like I've understood it. But when I sit down to write the code myself, I get stuck and sometimes don't even know where to start.

I guess understanding code while someone explains it and actually figuring things out on your own are two different skills. I'm still working on that gap myself.

Glad to know I'm not the only one who feels this way.

1

u/Charming_Airport6076 21d ago

You learn to code by coding. Design a small task and implement it. Use the online official documentations or the python REPL help() and dir(). Enjoy it, do something fun, maybe a small tool for you.

1

u/openmeasure 21d ago

How I broke free is don't follow the tutorials strictly. Always just use them as a reference and make your own project /ideas. It will slow down the progress significantly but will start requiring you to make your own decisions problem since etc which is really what coding is.

1

u/OSKyle 21d ago

You're stuck in recognition mode. Tutorials train you to nod along. Writing trains recall.

A drill that works well right after numpy/pandas:

  1. Watch or read for 5–10 minutes, then close it.
  2. Write the goal in one sentence without looking ("load this CSV, filter rows where X, group by Y, plot mean of Z").
  3. Build it from memory in a blank file. When you blank on syntax, use the official docs or help() in the REPL — not the video, not an AI autocomplete wall.
  4. Change one requirement the tutorial never had (different column, extra filter, save to a new CSV). That forces decisions.

Exercises beat passive tutorials. Tiny projects beat exercises once you can finish an exercise without peeking.

For pandas specifically: grab any CSV you care about (bank export, workout log, game stats) and answer three questions you actually want answered. That's a project, and you'll remember the verbs because you needed them.

1

u/aqua_regis 21d ago

How? By not following tutorials and writing your own code. Really that's what it is. You need to start very small and simple and work your way up. Most beginners try to go way too complex and large with their first projects. Stay small: Tic-Tac-Toe, Hangman, Blackjack, ToDo List, Battleships, Conway's Game of Life, Alex K. Dewdney's WaTor, etc.

You need to solve problems to train your problem solving skills. Tutorials are not going to teach you such skills.

There are already more than enough similar posts. Below are some of them:

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

Last, a great practice site: https://exercism.org

Stay clear of LeetCode, Hackerrank, etc. for now until you improve your problem solving skills through simpler sites, like the one linked above. Otherwise, you will only become even more frustrated.

1

u/Sapphire8593 20d ago

I would just quit trying to do things from scratch and just take the projects that are ready and that interest you and try to understand what they are doing and then modify small parts of the code and see what changes. Build a big library of understanding ready made projects and in time connect the dots to form a graph.

You need to have a goal, a specific thing you want to do in mind. Do what interests you the most in the moment, thus you have motivation.

I prefer to work in Unreal Engine with Blueprint. The effects are actually visible. It helps if you can see what is actually changing with your modifications.

Depends on what you want to program.

1

u/EszterSantos72 20d ago

Doing 10-20 targeted exercises per topic is the step you're missing, since this repetition cements pandas and numpy syntax in memory. Projects come after, but skipping exercises makes it harder to recall functions when building something new.

1

u/jacksonanna373 19d ago

Close the tutorial and rebuild the result from a blank file. Then change one thing. Looking up syntax is fine; copying the next line is what skips the practice.