r/pythonhelp • u/aaravsharmxa • 1d ago
why does python make sense in tutorials but not in actual coding
I'm a first year student learning Python rn and I swear everything makes sense when someone explains it but the moment I try to solve a question on my own, my brain just stops working is this normal in the beginning or am I missing something? how did you guys get better at solving problems without looking at the solution??
8
u/Hyperion343 1d ago
Coding is taking a big problem and breaking it down into smaller and smaller problems until you can solve one. Then the next one. Then the next one. Etc.
You have a problem to solve. Well, I need to do X. How do I do X? How do I do even the first part of X? What about the tiniest sliver of X? Get it down so small that I know how to do one line that gets me in the right direction. Then do the next line. Keep doing lines one at a time and eventually, you're done.
That's what it feels like to me, at least.
2
u/paul5235 1d ago
I agree. With more complex problems, it's often not even clear what X is and it's a good idea to first write down what the code is even supposed to do. For example: There needs to be a text field and a submit button, when the button is clicked, the contents of the text field needs to be sent to the server and the button must be disabled. When a response from the server is received... Nowadays that could be the prompt of a vibe coder, but without AI you can also use it for yourself.
4
u/Mediocre-Pumpkin6522 1d ago
Pick a task that interests you. An example would be reading a .json file and writing out a csv that contains some or all of the values. How do you open the json file? How do you parse the values? How do you create the csv header? How do you write out the values? How do you use the json module?
Look up the answers in the Python documentation when you don't know how to proceed. Do not ask Claude or some other AI to spoon feed you.
1
2
u/masterofaiml 1d ago
You need to keep practicing it until you master it, and it’s the same with everyone who is at beginning, nothing to worry and you are doing good.
Try www.pythonmastery.io, you have everything here to learn and practice.
Cheers!
1
2
u/avocadotz 1d ago
Yeah, that's pretty normal. Understanding someone else's code and figuring out how to write your own are two different skills. Try solving smaller problems first, even if it takes you 20 minutes to figure out something simple. Don't look at the solution too quickly. If you're stuck, write down what you want the program to do step by step before coding. It gets easier with practice
1
1
u/Ron-Erez 1d ago
Solve simpler problems and work harder. It’s the difference between watching someone ride a bike and riding a bike yourself.
1
1
u/Educational-Paper-75 1d ago
Because using it yourself to make a software system is about problem solving not just understanding how a problem was solved.
1
1
u/AlexMTBDude 1d ago
If you're not coding yourself WHILE watching the tutorial then nothing will stick. Have Pycharm, or whichever IDE you're using, up while watching the video, pause it, write code, play some more, write some more code, and so on. It's the only way.
2
1
u/sr105 1d ago
Once you have working code, modify it over and over again a little at a time to see how your changes affect the program. You will really learn this way. It'll help to use a simple version control system to take snapshots "working with experiment X" so when you break it and don't know why, you can go back or compare and learn.
1
u/StructuredChess 1d ago
You're living in what programming teachers call "tutorial hell".
You need to start writing code ASAP. No checking solutions, no AI. Just you, the IDE and the struggle. Start with the most simplest programs and progressively add complexity to it.
1
u/aaravsharmxa 1d ago
em yeah the tutorial hell reallly caught me up, rn i'm just gonna follow the advices i got from here
1
u/Creepy_Purchase_501 1d ago
Yes, it’s perfectly normal. Just like when you’re learning a new human language, it’s much easier for you to recognize familiar words and phrases than to try and express them yourself. For more theory on why this is, look up stages of competence.
My recommendation is to always put whatever you just learned into practice, in your own way. For every concept you learn, think of an application and implement it. Explore its behaviour. Try to trick it. See how far you can push it. Have fun with actually using it, like you would with a new toy you got as a child.
1
u/Capable-Package6835 1d ago
Because tutorials go through solutions following the order of execution: first do A, then B, then ... However, solving a problem typically requires drafting a high-level solution, writing the detailed implementation, testing, and iterating in a non-linear and convoluted sequence.
This is not unique to Python. Try learning math by simply listening to explanations, without ever solving a problem yourself.
1
u/hesusruiz 1d ago
This happens also with natural languages: for most people, understanding a foreign language (reading or listening) is much easier than speaking it, especially when trying to describe complex things.
The solution is basically the same: start with simple exercises where you have the solution but do not look at it until you try solve it yourself. Practice is your friened.
1
u/Derekthemindsculptor 1d ago
You can't learn to do a back flip if all you do is watch youtube tutorials on doing backflips. They help, but you still have to get out there and start flipping yourself. Falling on your face, getting hurt, failing. You'll have to do the hard stuff to be able to do the hard stuff.
1
u/kawfeeman68 1d ago
It's understandable.. that you feel that way. I think many do. You just need to think in python then you'll recognize how python would solve the problem. It's like learning another conversational language. You need to give it enough hours of practice AND MISTAKES, to get the hang of it
1
u/Imaginary-Deer4185 1d ago
I found that what works best for me is creating Python classes, instead of just a collection of functions, maybe that can aid you to decompose the task into smaller parts?
1
1
u/FatDog69 1d ago
It is a 'language' just like German or Russian. You might be able to understand some words to get the idea of what a native speaker is saying - but because you don't think in that language you are un-able to respond.
Python is just another language. Easier to read, harder to write.
Looking things up on the web/using AI is an every day occurance.
Go ahead and find code snippets that do what you want. But instead of cut/paste - hand type the code into your project.
Like any skill or sport - practice, practice, practice.
And frankly - you are just learning the alphabet. You are not expected to write the next best selling novel. Give yourself grace to be confused, try things, fix things. Eventually you will hammer some code out that works. It won't be elegant but at your level - nobody cares. Good structure, good design comes later. Do your A,B,C work and just practice.
1
1
u/LongjumpingFee2042 1d ago
Because you do not understand python or coding yet. You understand the explanation when given to you.
Less tutorials, more trying to make shit.
I literally spent 2 hours a day on it for a year. Just trying random bullshit.
1
u/codeguru42 23h ago
> how did you guys get better at solving problems without looking at the solution??
I'm willing to bet you expect to just see the entire solution to the problem in your head. Instead, I recommend breaking the problem into smaller problems that you know how to solve. Do you need to read input from a file? Then open the file and read each line one at a time and print the line back out. Note how this doesn't solve the entire problem, but it solves one small part. Then next, what do you need to do with each line from the file? Find one small part that you can do.
TLDR, don't try to solve the entire problem at once. Break it into small parts that you can solve one at a time.
1
u/InjAnnuity_1 21h ago
I suspect that you're trying to develop two different skills at once: 1. Breaking a solution down into computer-executable steps, and 2. Writing those steps as Python code.
You may have more success on a problem by doing #1 before #2. If you try to do both at the same time, you'll have a lot more details to contend with all at once.
1
1
u/MarkoDahl54 19h ago
The missing piece is real-world error handling and debugging, which tutorials often skip, in actual coding, you need to manage exceptions with try/except and understand stack traces when things break.
1
u/Dangerous_Cup3607 15h ago
Coding is an art of its form in computer science, when you enter the workforce there is no “referencing solutions” and therefore you have to be creative with it and come up with a solution. Tutorial only shows you the coding path but never able to show you the thought process such as exception and error handling. Like creating a calendar program and asking for user input a date, but you have to be creative to safe guard program run time such as validating user input and validate program output, and produce result or exception message.
1
u/Blammar 15h ago
Funny thing about writing code yourself: YOU HAVE TO UNDERSTAND EVERY SINGLE LINE OF CODE YOU WRITE.
You can't skip over things. You can't hand-wave anything.
So when you watch a tutorial, your brain isn't going through the process of writing line 1, then line 2, etc.
That's the difference.
There's no royal road to coding. Start with something VERY simple. E.g., write a python program to print the powers of two from 0 to 100. Once you've forced the process through your brain, try another problem. Etc.
•
u/AutoModerator 1d ago
To give us the best chance to help you, please include any relevant code.
Note. Please do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Privatebin, GitHub or Compiler Explorer.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.