r/learnpython • u/TheAzGreenPhoenix • 13m ago
Learning Python at 37 and I can read code fine but can't write 10 lines without the lesson open
37, learning Python in the evenings for about 3 months. I can read other people's code and follow every lesson, but the moment I close the lesson and try to write something small on my own, like a script to rename my photos, I'm stuck after a few lines. I did a free intro course before this and hit the same wall, so this time I'm paying for something structured. What made writing code on your own start to click?
7
Upvotes
•
u/crashorbit 7m ago
That's actually how the process goes. Fourteen hours to competence. Two thousand to expertise. The normal coding workflow is to start with some simple scaffold then cycle incremental improvement in the code till it gets done. Usually I have the editor, doc window and a testing window up when I'm writing code.
•
u/joeshmowe 9m ago
Repetition
•
u/desrtfx but other languages pro 6m ago
You need to write code on your own - practice.
Practice is the only thing that can help you improve.
Sit down with pencil and paper and plan your program. Write down the overview, then detail each part. Then, develop your solutions for each part. Then, once you know what to do, start programming it.
It is a very common problem nowadays that people can follow tutorials that pre-chew and serve everything for them, yet, they never learn to think independently. That's why most tutorials around are actual garbage. They serve the solutions instead of making the learner work to develop the solutions.
A proper course, like the MOOC Python Programming 2026 from the University of Helsinki, does the opposite. It hands you the tools (keywords, commands) and demonstrates how to use them, then makes you do the actual programming through plenty practical exercises where you only get the prompt and have to develop the solution on your own. The course gives everything you need in the preceding textual chapters and then has you use what you learn.
The difference between reading and understanding code and writing it is the same as reading and understanding novels and writing comprehensive, fully developed ones. Just because you can do the former does by far not enable you to do the latter. In order to do the latter, you need to write. You need to write plenty bad ones.
•
u/impatientSOB 4m ago
Repetition is definitely important but you need to learn to read your error output when you try to run your app/script. It tells you everything you need. Instead of looking up the code, look up what the errors mean.
•
u/mooglinux 2m ago
This is a very normal part of learning, don’t get discouraged. Focus on breaking down what you want the code to do first, then figure out how to work the code to accomplish that. Start with very very very small things like a function that does ___ and with practice you’ll be more comfortable.
•
u/Quirky_Database_5197 2m ago
do you have any goals in mind? why are you learning python? it's hard to give you an advice without that context.
•
u/RngdZed 2m ago
Here's what I did to make me learn and understand python back in 2020ish..
Codewars.com to practice syntax and algos with fun little problems. Also helps you translate problems into steps, then each step translates easily into python code.
Also try some tutorial with a gui, like a pygame tutorial. Once you're done with the tutorial, and you have a "full" working game. Copy the file, rename it, then modify the code inside to fully create another game. Obviously this works great with games that are similar in nature. In example, create a pong clone with a tutorial, then flip that thing on your own and make a breakout clone from it.
Also if you're interested, I'm working on a tutorial of my own and will create a YouTube series somewhere in 2027. I can share the GitHub if you'd like. It uses jupyter notebooks (I have a diploma in data science). Only thing I ask in return is some kind of feedback hehe
Have fun!
•
u/spendology 7m ago
Never remember what you can look up. It's okay to continue referencing code or lessons as you work on new projects.